January 11, 2019 at 2:11 pm #18141
I have a custom post type “bars” and I have one page with 5 hotels. Is it possible to show in a mash up all the bars in the category and the 5 hotels from the page?
I tried this [mashup query="post_type=bars" query="post__in=19" width="100%" height="600"]
But it only shows the second query? Can they be combined? If so what is the code?January 11, 2019 at 2:18 pm #18142
There’s no way to pass ‘OR’ queries like this through the shortcode.
However, you could assign all the relevant posts to categories rather than using post type (e.g., category ‘bars’ and ‘hotels’), then query by all the necessary categories (you can separate categories by commas).
Or, group them under a specific separate taxonomy just for the purpose of combining them, such as a ‘map1’ tag.
There are some example queries here:
http://mappresspro.com/mappress-documentationJanuary 15, 2019 at 7:50 am #18145
I changed the hotel page to a post and assigned it a category hotel.
I then created the mash-up
[mashup query="category__and=bar,hotel&posts_per_page=-1" width="100%" height="600"]
But it is showing all of the actual categories, not just the two I specify? Have I made an error in the shortcode?January 15, 2019 at 7:52 am #18147
Hi, that query only finds posts with both categories. I think you want posts in either category, which would be:
There are some additional examples in the documentation:
http://mappresspro.com/mappress-documentationJanuary 21, 2019 at 6:29 am #18154
I tried that too..
[mashup query=“category__in=bar,hotel” width="100%" height="600"]
But it is bringing up all the categories (beaches, saunas, restaurants)January 21, 2019 at 6:29 am #18160
Any idea why all categories are showing up? I checked the categories and they are all separate. no sub categories etc.January 21, 2019 at 6:30 am #18162
I haven’t had a chance to look at this over the weekend, but I haven’t forgotten about you. I’ll test it on my own system and let you know if I can replicate the problem.January 21, 2019 at 6:51 am #18163
I just tested this and the query seems to work for me. But I think I see the problem: the various WordPress query selectors work either on names (slugs) or IDs. If the wrong type of argument is provided, WordPress will ignore that part of the query and show all results.
In the example above, ‘category__in’ uses IDs, so it would need to be something like ‘category__in=1,5,7’. For names, use ‘category_name’ instead, e.g. ‘category_name=red,blue,green’.
There are some examples of the various selectors in the docs, or the WordPress codex page.
Be careful to also match the underscores – some selectors use two and some use one.February 5, 2019 at 2:59 am #18193
I tried both category id and name and it still seems to bring up all.
[mashup query=“category__in=12,22” width="100%" height="600"]
Am using Easy Custom Post Types plugin to create the custom posts, perhaps this might be causing an issue?February 5, 2019 at 3:01 am #18194
I don’t know about the other plugin. What happens if you set up a standard post category and assign a few posts to it. Does the query work then?
If not, please use the contact form to send a login and I’ll try to trace the issue for you. It’s working on my test blogs so I’ll need to see it on yours (preferably a test system, if you have one).February 5, 2019 at 9:19 am #18197
ok i sent you log in credentials via the form.February 5, 2019 at 9:23 am #18198
I looked at the site and I think the problem is the quotes in the shortcode. It contained angled quotes, which are normally used by visual editors. WordPress ignores this type of quote when processing shortcode arguments.
What you need are straight quotes, which is what are input using the normal WordPress editor (you can check by using the ‘text’ tab instead of ‘visual’):
I created a private post here that shows the different quote types:
And also corrected the original mashup.
I hope that helps!
You must be logged in to reply to this topic.