In this project we work through the proper techniques for creating taxonomy filters on custom post type archives. We’ll use these filters to adjust the main query and even dynamically insert the filter controls on the post type archive page itself.
After we have the basic filtering mechanisms in place, the next step is introducing a “Post Favorites” feature. This feature allows visitors to add or remove posts to their list of favorites, which are tracked in their browser’s own local storage, and then filter the results of the post type archive to display only their favorites.
By design, both the taxonomy filters and the favorites filter pass data through the URL. This makes the filtered view sharable and makes it navigable as well, allowing someone to navigate back/forward through each of the filtered views that they apply.
Here’s a look at all of the things we tackle in this series:
- Project Scoping – get a comprehensive overview of what we’re going to build.
- Plugin Scaffolding – quickly create a new plugin for custom data storage using WP-CLI.
- WP_Query Crash Course – get a quick look into some of the lesser-discussed aspects of WP_Query and some of the hooks that make it extra powerful.
- Modify WP_Query the right way – learn how to safely alter the main page query, rather than introduce a brand new query.
- Dynamic Archive Filters – See how we can dynamically insert taxonomy filters on any post type archive.
- Post Favoriting through Local Storage – Learn how to tuck custom data into the browser’s local storage
|1.1||Filterable Archives Overview||18:35|
|1.2||WP_Query Advanced Features||25:31|
|2||Query Filtering||1.95 hours|
|2.1||Parsing Query Strings||42:35|
|2.2||Creating Filter Controls||42:29|
|2.3||Filtering the Main Query||32:07|
|3||Post Favorites||1.0 hours|
|3.1||Capturing visitor input in Local Storage||38:41|
|3.2||Adding a “Favorites” query filter||21:44|