Filter by category so that only those locations are shown on a leaflet map?

I created a custom post type for dealers. Via a loop through these custom post types, I can display those dealers on a Leaflet map. There are 4 categories of products that dealers can sell. Some dealers sell 1 type of product, some sell 2 or more.
Now I would like that at the front end the visitor can check 1 or more products (categories), after which only those dealers who offer those category products will be shown.

What is the smartest way to do this with Loops & Logic and Tangible Blocks?

(PS: I also looked at Control blocks, but understand that this is only for the backend).

I hope someone can help me on my way, many thanks in advance! And if there are any additional questions, feel free to ask!


This thread might be useful for you:

Basically, the two approaches I’ve seen people use on this forum involve either using FacetWP (requires some PHP tinkering) or creating links that have URL query parameters like and then using the Url tag’s query attribute to modify your L&L template based on the value of the parameter in the current URL.

I hope that’s helpful for you!

Hi Benjamin, thank you so much, with your instruction it did indeed work! Now I still have to figure out how to make everything show at the start :wink:

Thanks so much!

1 Like