Topic: Help with Custom query | WP Masonry Layout

Help with Custom query

Home Forums Pro Version Help with Custom query

This topic contains 5 replies, has 2 voices, and was last updated by  Masonry Guy 1 year ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #12531 Reply

    Vicky

    Hi,

    I am using the masonry gallery to display a custom post type. In this custom post types I have custom fields. Example: city. I would like in the masonry plugin custom query to only show the entries from Toronto. Example: show all post from city=”Toronto”.

    I tried city=”Toronto” in the Custom Query box and it did not work.

    I tried also to use the filter in the function.php and not look either:

    add_filter(‘wmlp_query’, ‘my_custom_query_wmlp’,10,2);
    function my_custom_query_wmlp($args, $shortcodeID){
    if ($shortcodeID == 4){
    $args[‘city’] = “Toronto”;
    return $args;
    }
    }

    Any idea what I am doing wrong?

    Thanks in Advance,

    Vicky.

    #12536 Reply

    Masonry Guy
    Keymaster

    Hi Vicky,

    First, can you please let me know what City is ? Is that post type or taxonomy ? If it is taxonomy can you please make sure its slug is city as you have mentioned ?

    Thanks

    #12602 Reply

    Vicky

    Hi, thanks for your answer.
    It is a custom field named city inside a custom post type.
    Thanks.

    #12612 Reply

    Masonry Guy
    Keymaster

    Hi Vicky,

    In that case it should be meta_key=city&meta_value=Toronto. For custom field we need to use meta key for field name and meta value for field data.

    Thanks

    #12640 Reply

    vicky

    Hi,
    Thanks so much. it works!
    Vicky.

    #12655 Reply

    Masonry Guy
    Keymaster

    Hi Vicky,

    Glad it is working for you.

    If you have a few mins for us, can you please write us a review for our plugin at https://wordpress.org/support/view/plugin-reviews/wp-masonry-layout? This will help us grow and makes easier for others to decide to use the plugin.

    Thanks

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Help with Custom query
Your information: