One of my first experiences with the social web was Del.icio.us. I stopped using it shortly after Yahoo! aquired it, but that’s a different story. The reason I bring it up is because I loved the way that you could search for multiple tags by including a + sign in between each tag in the URL. Can you even do that anymore?
So, I’ve been wanting to do this with WordPress categories for a while now and recently had the motivation to make it happen (aka: a client needed it).
Below is my first draft. It only works with permalink structures for now. I’m looking for some feedback and ‘beta testing’ before I put it into the WordPress plugin repository. Would anyone like to help?
How it currently works:
- Download, unzip, FTP to your site’s plugins folder.
- Activate the plugin.
- Visit http://yourdomain.com/categories/cat1-slug+cat2-slug+cat-3slug+etc/
- You should get a listing of all your current posts that are in all of the above categories.
Templates, Titles, etc
I am currently using the following logic for determining what theme file is used to display your posts:
- If there is a file called categories.php, use that.
- If there is a file called archive.php, use that.
- If there is a file called index.php, use that.
- If there is a file called 404.php, use that.
I currently have the following functions available to help you build a title for your archive page
- is_categories() returns true if you are on a categories page ie: /categories/ is in the URL
- ft_mca_titles() returns an array of titles for each of the categories in your URL
Download the zip file here: ft-multiple-category-archives.php.
Leave comments below. Thanks!