Looper Provider Query String with URL Parameter

Hello,

I’ve added a looper provider query string to a page, it has a URL parameter in it.

post_type=virtual_events&post_status=publish&ignore_sticky_posts=1&posts_per_page=-1&orderby=title&order=asc&tax_query%5B0%5D%5Btaxonomy%5D=category&tax_query%5B0%5D%5Bfield%5D=slug&tax_query%5B0%5D%5Bterms%5D%5B0%5D={{dc:url:param key="cat" fallback="all"}}&tax_query%5B0%5D%5Boperator%5D=IN

This is working as expected, if add “?cat=education” to my url it shows that category in the looper results.

However, when I land on the page without any url query parameters nothing shows. I read a previous topic where you mentioned that I will need to add a second looper to show all results.

I tried adding that, but then those results still show when I add in my url query parameter. How do I stop this from happening?

Hello @NinjaTeX,

Thanks for writing in!

The query string is doing exactly what is told. Your set up is lacking something. You will need to have to set of Loopers:

1.) First One: post_type=virtual_events&post_status=publish&ignore_sticky_posts=1&posts_per_page=-1&orderby=title&order=asc

In this Looper, you will have a condition that when {{dc:url:param key="cat" fallback="all"}} IS "all" it will display.

2.) 2nd Looper: post_type=virtual_events&post_status=publish&ignore_sticky_posts=1&posts_per_page=-1&orderby=title&order=asc&tax_query%5B0%5D%5Btaxonomy%5D=category&tax_query%5B0%5D%5Bfield%5D=slug&tax_query%5B0%5D%5Bterms%5D%5B0%5D={{dc:url:param key="cat" fallback="all"}}&tax_query%5B0%5D%5Boperator%5D=IN

And this one will have the opposite condition of the first one.

You will have to do this way so that when you land on the page, there is no URL parameter yet, so the first looper will display.

Hope this makes sense.

Thank you! This works.

Hi @NinjaTeX,

Glad to know that it works.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.