Welcome to Redradar!

I'm Kelly, and I'll be your host today. I'm a recent grad trying to figure out life. I have interests and a resume, if you're looking for web developer (preferably in the Western MA area). I also have wordpress plugins & other projects; and sometimes I talk about interesting tech topics. I hope you enjoy your stay, and come back often! (alternately you can follow me on twitter, or grab my RSS feed)

Log in?

Name:
Pass:
Show me?

Category Intersection Plugin

Posted on Dec 26, 2008 at 08:15 PM

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.

Powered by WordPress