Hi,
thanks to this topic and the video referred to, I’ve been able to build a nice filter button. Clicking on a button will alter the category_name
part of the query.
I’ve got a question and a suggestion.
To start with the latter: fields like the url-field of a button and the looper provider settings are just single-line input fields. That’s very inconvenient. In many occasions, especially when using Dynamic Content, it’s hard to see the entire input. I find myself copying and pasting between those fields an text-editors on my pc, just to be able to see all the input I provided.
Now Pro is enabling more and more advanced functionalities using DC, twig etc, could we please get rid of single-line input fields and replace them with auto-growing or text-areas?
My question: I have added buttons, as shown in the video referred to, that alter the WP_Query. But the buttons don’t yet style accordingly. They do in the video however. Is there an explanation on how to style those buttons, so when the url-parameter is changed to filter by a certain category, the button that matches that, will be set as active? Or is there another approach I should be looking at?
To illustrate, these three buttons all alter the ?category_name
parameter of the looper provider.
The first clears the parameter:
The other two set the parameter:
The looper provider: post_type=activiteiten&orderby={{ url.param({"key":"orderby"}) | default('title') }}&order=asc&posts_per_page=-1&category_name={{ url.param({"key":"category_name"}) }}
When category_name
is empty
, the first button should be highlighted. When category_name
is buiten_activiteiten
the second one should be highlighted. In the video a system like that seems to work, but I havent been able to find a description of how to do that. Any tips are very welcome!