I am trying to override a query in a loop which exists in other plugin. I created an extension to override that loop using a hook that exists in the plugin.
The plugin query:
query_posts ($args);
/*
Some codes
*/
do_action('the_action_Triggered');
/*
the loop
*/
In my extension:
add_action('the_action_Triggered','geo_srt_reset_query',200,1);
function geo_srt_reset_query(){
global $wp_query;
$wp_query->set('meta_key','place_order');
$wp_query->set('orderby','meta_value_num title');
$wp_query->set('order','ASC');
//print_r($wp_query);
query_posts($wp_query->query_vars); // i tried with this line and without it.
}
So if you think you can offer some help, please don't hesitate.
Aucun commentaire:
Enregistrer un commentaire