Topic: Custom Query | WP Masonry Layout

Custom Query

Home Forums Pro Version Custom Query

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  Masonry Guy 1 year, 3 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #11404 Reply

    Ben De Troyer
    Participant

    Hello

    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 1 year, 3 months ago by  Ben De Troyer.
    • This topic was modified 1 year, 3 months ago by  Ben De Troyer.
    #11408 Reply

    Masonry Guy
    Keymaster

    Hi 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

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Custom Query
Your information: