Categories are nice, but truthfully, given the choice, I’d probably use tags wherever appropriate. Whereas categories are innately related to each other based on their hierarchy, tags initially do not have any relationship with each other. It’s by their pairings that relationships and meaning are formed. Which tags are associated with another is totally up to the user, and these associations can change from one instance to another. Sure, “tags” are just “keywords”, but it’s really their application as terms that can be used to get results that are as general or precise as you desire that really gets me interested. I’ve always loved the power of “intersections” in databases, and that’s exactly the functionality tags provides.
Yesterday, I added support for categories in sections. I did that first because categories are a core component of any default WordPress install. More importantly, categories are “easier” to work with if you’re not familiar with how tags work. As one of my primary uses for this CMS plugin is to build websites for others (who may not be very tech-savvy), support for categories was very important. Once I got that out of the way, I was free to add support for tags in sections, which is what I think I’ll be using more often. More specifically, I added support for the Ultimate Tag Warrior plugin (UTW) into sections as this is the plugin that I use for tagging content. It’s a good plugin, and satisfies my needs quite nicely. Interestingly, though there does appear to be code to detect whether an RSS feed of the tag results is being requested, it doesn’t appear to be fully implemented. I commented on the author’s site asking about this, but in the meantime, I added RSS feeds to the tag results within sections. That means a visitor can subscribe to a feed in a section (“books” for instance), along with some tags (let’s say “sci-fi” and “water”), and they will be notified via RSS whenever a new item containing those tags is added to that section. Well, at any rate, I think that’s pretty nice.
Thankfully, getting tags to work in sections didn’t take too much work. All I it took was adding a new rewrite rule to the
wp_rewrite->rules array to redirect any request to
domain.com/section-name/tag/tag-names to a something like
domain.com/index.php?section=section-name&tags=tag-names. I found that I could not pass the tag-names using the query variable
tag as UTW was already using that, so I just added the
tags query variable (using the
query_vars filter) to the
wp_query->query_vars array so that I could use the tag-names to filter which posts were displayed in the section.
Did I mention that I also added RSS feed support to categories in sections? This provides pretty much the same functionality as the feeds for tags in sections, but for those who use categories instead.
In fact, you can even get the same functionality as tags since I added support for category intersections today. This means that by visiting
http://domain.com/section-name/category/sci-fi+water, you’ll only get posts that are assigned to both “sci-fi” and “water” categories. RSS feeds work here as well (can you tell I like RSS?)
I held off from working on adding support for custom RSS templates today, but I do have a few leads on how to do it. For one, I could simply make the rewrite rule for the feeds within sections point to a file in the theme’s directory, thus giving the theme-maker the ability to customize RSS feeds. This would leave the default RSS feeds untouched, but allow custom features (such as plugins) to use customized feed templates. Another possible option is to use the
template_redirect action to redirect certain requests (e.g. requests for feeds) to files in the theme directory. I’m still trying to decide whether it would be better to have customizable RSS templates live in WordPress’ admin menus or in the theme directory. Having available in the admin menus would mean that only those with the proper access level could modify them and the RSS feeds could stay the same regardless of which theme you want to use. Now that I think of it, I guess it would be better to have RSS feed templates managed from the admin interface, but it just might take a little more work than simply redirecting the request to a file in the theme’s directory.
I finished off the day by adding support for listing only categories and tags that are used by the items in that section. I’ve still got a bit more work to do in this area, and once I’m done with that, I’ve got to figure out the best way to allow users to add categories/tags to further refine results (ala del.icio.us).
However, the next big step I have to tackle is refining the administration interface so that it’s simple to manage and modify all of the content. Really looking forward to that….yeah…:)