The Easiest Way to Get Custom Post Type Archives for WordPress 3.0
Custom post type archives are not automatically built into WordPress, so it’s something you’ll need to add if you plan to display an archive. A month ago we provided a guide for simulating custom post type archives for your WordPress theme through a process of creating a custom page template and calling the post type on that page.
Now there’s an even easier way to show custom post type archives on your WordPress site: Use a plugin!
Custom Post Type Archives Plugin
Custom Post Type Archives is the plugin with the most features for creating archives for your custom posts. It allows for customization from the WordPress dashboard for permalink structure, title, what templates to include and what post types will have archives.
After installing Custom Post Type Archives, you’ll be able to do the following:
- specify a URL base for custom post archives
- specify which template to include for which custom post type
- specify how titles appear for custom post type archives
- select which custom post types will have archives enabled
Without the plugin, the way WordPress naturally outputs the URL would look something like this:
With the plugin installed you’ll get a prettier URL:
The post type can now become a more natural part of your menu. You’ll be able to assign any custom template to your post type archives or a fallback template in case you haven’t created any custom templates.
Extra Functions For Theme Developers:
If you’re a theme developer, then you’ll be glad to know that this plugin also provides you with two highly useful functions:
- is_post_type_archive – Similar to is_category or is_single, it will return true if this page is a custom post type archive or false if it isn’t.
- get_the_post_type_permalink / the_post_type_permalink – This is used to return or echo the permalink for the post type.
RSS feeds for your new custom post type archives are available if you add /feed/ to the end of the archive URL.
Those are a few highlights of the Custom Post Type Archives plugin. It’s the best option for easily customizing your archive URL’s and selecting templates for each. More information can be found at the plugin’s homepage – http://ratvars.com/custom-post-type-archives/Tags: