In this article we are going to add a Sub Category dropdown, a Monthly Archive dropdown and a Category-specific Search next to each other above the loop on category archives in Genesis.
Sub Category filter dropdown will automatically get populated with sub categories of the current category being viewed. Selecting a sub category will work as expected - take the user to that category archive page.
The Date filter dropdown displays all the months in which Posts from the current category have been published. Selecting a month will display the posts from that category published in that month. Filter bar will continue to appear even after the user lands on monthly archives. Thanks to Gary Jones for helping with the code for this.
Search box filter limits the search results to only Posts from the current category.
Step 1
Add the following in child theme's functions.php:
To view the full content, please sign up for the membership.
Already a member? Log in below or here.
This looks like a very useful feature to add to sites with many posts and categories. Thanks Sridhar. 🙂
Looks good but once the category is selected is there a way to add an option to the dropdown that will show all posts again ? Rather than pressing the back button on the browser ?