Home › Forums › Pro Version › Custom Query
Tagged: Custom Query
- This topic has 1 reply, 2 voices, and was last updated 4 years, 10 months ago by
Masonry Guy.
- AuthorPosts
Ben De Troyer
ParticipantHello
I’m trying to get the order of my events right. It should be ordered by event start date (‘eventstart’) and Ascending. When I use following code, it works fine for the shortcode with ID 1 (in my case). But the problem is: my other shortcodes don’t work anymore! (I used WP Masonry Layout for a few custom post types, but this function should only be working for the shortcode with ID 1).
add_filter(‘wmlp_query’, ‘my_custom_query_wmlp’,10,2);
function my_custom_query_wmlp($args, $shortcodeID){
if ($shortcodeID == 1){
$args = array(
‘orderby’ => ‘eventstart’,
‘order’ => ‘ASC’
);
return $args;
}
}In the field “custom query” i put the following: wmlp_query
Could someone please help me with this?
- This topic was modified 4 years, 10 months ago by
Ben De Troyer.
- This topic was modified 4 years, 10 months ago by
Ben De Troyer.
Masonry Guy
KeymasterHi Ben,
The code looks good and should work fine. So other shortcode are you getting any error ?
You don’t need to keep any thing in custom query box if you are using filter. Or you can remove the filter and just use this in custom query box orderby=eventstart&order-ASC
Hope this helps.
Thanks
- This topic was modified 4 years, 10 months ago by
- AuthorPosts