• Resolved davgraham

    (@davgraham)


    Firstly many thanks for a supremely powerful plugin. It’s going to change the way I use WordPress in the very near future, so glad I discovered it!

    Just one problem so far that I’m hoping you can help with. The slight scarcity of documentation means I’ve not been able to solve this myself.

    I’ve created a custom post type called “store” and a custom taxonomy “country” (USA, CA, UK) etc.

    I would like to use the Pods shortcode to display a list of stores that match more than one country. For example, stores that accept orders from the USA and UK.

    The closest I could get was this:

    [pods name=”store” where=”country.name IN (‘usa’,’uk’)” template=”store template” limit=”5″ orderby=”rating DESC”][/pods]

    This doesn’t quite do what I want, I understand that it’s an OR statement and therefore matches stores that are either tagged “usa” or “uk” but not necessarily both. What I need is a list of stores that match both.

    Having searched through the Pods documentation and this support forum, I only found one similar question in which the poster then said he’d solved it, but unfortunately didn’t share how. Therefore asking again if you have any solution to this.

    Thanks in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter davgraham

    (@davgraham)

    Hi. Does anyone have a solution for this please?

    Plugin Contributor Jim True

    (@jimtrue)

    You’re not going to be able to do that easily with a shortcode and

    where="country.name = 'USA' AND country.name = 'UK'"

    That will get unwieldy very quickly.

    Honestly, it sounds like you’re looking for a live filter (ie faceted search) like on Amazon, Best Buy and other sites like that. That functionality is better served by WP Plugins that work against multiple taxonomies and post-types and handle custom meta as well but do it all through indexed WP Query searches like Search & Filter, Beautiful Taxonomy Filters or FacetWP. We have direct integration with FacetWP and can highly recommend it.

    I have a very similar use case. I was expecting the query work. (where=”country.name = ‘USA’ AND country.name = ‘UK'”), but it doesn’t – it does work when you change AND to OR though, but I need both to be true. Why doesn’t it work with AND?

    In my use case, I’m building a product post with related products and I only want to show related items that have the same certain taxonomy terms, where tag.name=white and tag.name=living room and tag.name=chair and tag.name=on sale.

    I guess it could be solved with multiple taxonomies, but I’m trying to be frugal with my data structure and I know in normal SQL this type of query could be possible.

    Thanks for your help

    • This reply was modified 5 years, 11 months ago by Bob Kruse.
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Filter pods by multiple taxonomy using shortcode’ is closed to new replies.