Looking around in the WP codex, it dawned on me that there’s not much yet that’s been documented about how WordPress lets us manipulate custom taxonomies. Since WP2.3, we’ve been able to create custom post types, which can have their own custom categories and custom tags. The beauty of this is that, you can divide your content into regular posts (and use them exclusively for blogging) and specialized posts that are meant for non-blog stuff.
For example, I’m working on a classified-ads site and the premium theme package I’ve chosen makes use of custom post types. It’s a wonderful theme (ClassiPress) and I love it. Classified ads appear in their own custom posts called ad listings, and are posted under ad categories. The screenshot of the site’s dashboard (see image) shows an extra menu item that says “Ads”. The ad listings, their categories and tags are accessible under this menu.
The ClassiPress theme (made by Appthemes.com) has lots of cool built-in features, too, such as a way for ad posters — people who submit ads to the site — to mark for-sale items as “sold”. And, when ads are marked thus, the ad page would have a “sold” tag prominently displayed on it. Problem is, I’ve put in other classified-ads sections in the mix: For Hire, For Rent and Personals. It wouldn’t be a good idea to have, say, a caterer’s services advertised under the For Hire section to be marked as “sold”, would it?
in_category()and related functions would be enough. Wrong. That particular function only works with the default taxonomy system (ie., regular categories and link categories). So, I’d like to share here how I solved it.
The next page shows how I did it.