Home › Forums › Pro Version › Help with Custom query
- This topic has 5 replies, 2 voices, and was last updated 4 years, 7 months ago by
Masonry Guy.
- AuthorPosts
Vicky
GuestHi,
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.
Masonry Guy
KeymasterHi 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
Vicky
GuestHi, thanks for your answer.
It is a custom field named city inside a custom post type.
Thanks.Masonry Guy
KeymasterHi 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
vicky
GuestHi,
Thanks so much. it works!
Vicky.Masonry Guy
KeymasterHi 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
- AuthorPosts