With the release of WordPress 2.9 it brought in many new features, but a couple in particular I quite liked, and think they’d be very useful when building client websites or working on your own. Not just that, but out of every other release post, I never saw this mentioned once.
Up First The category-slug.php Template
Before it was added, all you had available was the standard
category.php template file which we’re all aware of, along with category-id.php which would have been used by some developers if they needed to show different layouts for each category archive. The trouble starts though if you’ve got 2 or 3 files like category-2.php, category-30.php and category-17.php then it get’s a little confusing if you forget what ID goes with which category!
So with the addition of
category-slug.php you can now have category-blog.php, category-announcement.php among many others. If you use the Top Level Categories plugin to build your site, that’s when it removes /category/ from the URL, and makes the archives look more like a page, you can truely IMHO take advantage of these template options.
Next We’ve Got The tag-id.php Template
After category-slug.php was introduced, another ticket was opened up asking if the tag templates could be brought up in-line with the category templates, which required adding the
tag-id.php and the WordPress Development Team agreed to so just that.
Finally The page-slug.php And page-id.php Templates
I’m not sure about you, but I much prefer the idea of using
page-sitemap.php to show my /sitemap/ page, over the custom page template in which you have to select from the template section within the post area of the admin area.
The same goes for page-4.php too, but like category-id.php and tag-id.php, if your site has a lot of page templates it can get a little messy inside the theme folder not knowing what file you might want to edit. Which is why I’d go for the page-slug.php option.
Just remember that whatever you use for the permalink, or URL, of your category/tag/page that you use it for these templates otherwise it’ll not work and they’ll default back to their respective category.php, tag.php and page.php templates!
What Are We Still Looking For?
If you take a look at the Template Hierarchy over on the WordPress Codex, you should see my point, as it’s about the only thing missing. And if you’ve not quite worked out what they are, then look no further than author-id.php and author-slug.php templates, am I right or not? Maybe it might just make it’s way into 3.0 you never know.
So there you have it, a little summary of a couple of new features that made 2.9, roll on 3.0!
You could say Mark plays about with WordPress from day-to-day, and has nothing better to do, but he blogs on Mark-McWilliams.com from time-to-time and when he’s got something to say! (Will be taking about WordPress on WPKid.com very soon!) And you can follow him either @markmcwilliams or @wpkid on Twitter.