Smarter Custom Post Types in WordPress 3.0
I recently installed WordPress 3.0, and am blown away. The latest version of the popular content management system introduces several killer new features. WP and WP-MU (Multi-User) are now integrated, which means you can administrate a blog network under a single WordPress administration panel. WP 3.0 also supports a custom menu system, custom post headers and backgrounds, and a streamlined administration UI.
But my favorite feature is Custom Post Types. Let’s say you run a movie blog, and want to have a separate listing for DVD capsule reviews, with the reviews containing affiliate links to Amazon.com. You don’t want these posts to show up in the main feed, as you may be adding several every day. Before 3.0, this required coding and template hacks. With WP 3.0, you can create a new custom post type specifically for your DVD reviews. This collection of posts will have its own tab on the Administration menu, just like Posts and Pages. By default, these custom posts are distinct from your main publishing stream, and can even have their own post templates.
Want an example? Visit my Humor page, which I generated by defining the custom post type “Humor.” Here’s a screenshot of how these posts appear in the Administration UI:
You can read a full tutorial on Custom Post Types at Justin Tadlock’s blog. But don’t start fiddling with your blog just yet! Hop on over first to Matt Wiebe’s Smart Custom Post Types page. Matt provides additional template code (it goes in your template’s functions.php file) that improves WP’s native support by enabling custom landing pages, custom index templates, and more. I used Matt’s code to generate the Humor page without defining any additional templates or functions.


