Multiple Looper (Category and Filter Buttons) simutaneously

Here is a previous forum for reference: Create Filter by category button

Continuing, how can I have the sort and category buttons work simutaneously? When I select a category, I would like to be able to filter it by oldest, etc - and have it only show that for the selected category.

Likewise, I would like the buttons to show what’s currently active. For example when the page loads, I would love for it to show “most recent” as active.

Thank you!

Hello Cassidy Stokes,

Thank you for the inquiry.

To preserve the previous query, you have to adjust the URL of the sort buttons and include the missing parameters. For sorting, you have to include the cat_name query string and retrieve the value using the URL > Query String Parameter. We edited the “Most Recent” button and adjusted the URL value to the following:

?orderby=date&order=desc&cat_name={{dc:url:param key="cat_name"}}#sort

We also edited the first category and adjusted the URL as follows:

?cat_name={{dc:term:slug}}&order={{dc:url:param key="order" fallback="desc"}}&orderby={{dc:url:param key="orderby" fallback="date"}}#sort

You have to apply these changes to every sorting and category buttons. Unfortunately, it’s not possible to adjust the style of the elements based on the query without custom scripts.

If you are interested in email-based help with third-party plugins and custom code, we encourage you to check out One (https://theme.co/one).

Best regards,
Ismael

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