how set the scope for the AJAX query with buddy press meta query

自作多情 提交于 2020-01-06 15:18:17

问题


I am trying to filter group with meta query with reference of bellow reference link code

https://gist.github.com/boonebgorges/2638943

This link code i have added in my function.php

and bellow code of spinet i have added in /wp-content/plugins/buddypress/bp-templates/bp-legacy/buddypress/groups/index.php in div groups dir-list

$meta_filter = new BP_Groups_Meta_Filter( 'group-custom-field-cat', 'Art and Culture' ); //print_r($meta_filter);
               echo @json_decode($meta_filter, true); 

Now if you visit the group page this code filtering the group which have meta key=group-custom-field-cat and value=Art and Culture.This workaround are good working.

On this same page i have to add one select box with option Art and Culture

If user select this option it will call the ajax query and run the bellow code so it will filter the group if have meta key and value like bellow.so how do i call ajax.

    <?php   if ($groupname=="Art and Culture"){
  $meta_filter = new BP_Groups_Meta_Filter( 'group-custom-field-cat', 'Art and Culture' ); 
                   echo @json_decode($meta_filter, true);
    }
   ?>  

working example:-http://tamrielfoundry.com/groups/

Can anyone know about this how to call ajax query which will fit to my need.

来源:https://stackoverflow.com/questions/30939788/how-set-the-scope-for-the-ajax-query-with-buddy-press-meta-query

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!