Category Intersection Plugin

Description: Enables intersection of categories: [your url]/?cat=1,2&and=1 will show posts only in both categories 1 and 2. [your url]/?cat=1,2&and=0 is the default functionality (shows posts from categories 1 or 2).
Author: Kelly Dwan
Version: 0.2
Wordpress 2.6 – 2.8

My first foray into the world of wordpress plugins, born of need for exactly that functionality. None of the functions we looked into seemed to work properly (there were conditions on the categories, it didn’t work with this version of wordpress…) so it seemed easier to write it myself.

To install, simply add the intersection.php file to your wp-content/plugins directory (remove the .txt extension), and activate the plugin. If, for some reason, you’re still using ver 0.1, and add the line:
<?php if ( function_exists('intersection') ) intersection();?>
in the header template (header.php).

I definitely welcome any comments or feedback, and if there are any questions I’ll try to answer as best I can.
EDIT 02/01/09: Clear up installation instructions.

EDIT 02/02/09: Edited meta in file header with a link to this exact post.

EDIT 06/13/09: New version with hooks, so you don’t even need to add code.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: