Jake Goldman by Jake Goldman download
requires 3.0+
16 votes
11,822 downloads
updated Aug 19 '10

Simple Custom Post Type Archives 0.9.3 for WordPress

Adds permalink support, template files, and a new conditional for public custom post type archives.

NOTE: WordPress 3.1 incorporates custom post type archives into core. Look for my upcoming blog post for details and a migration path!

WordPress 3.0 opens the door for entirely new content management possibilities with custom post types. As awesome as it is, the first version to implement custom post types is missing a few things. This plug-in patches one of those holes: templates and friendly permalinks that enable “archives” for custom post types, much the like the “blog home” is an archive for all “post” post types.

This plug-in will only add custom post type archives for non-hierarchical (post-like), public custom post types with a “slug” or permalink.

For example, suppose you have a custom post type Movies. WordPress 3.0 takes care of permalinks for individual movie content, for example, http://yourblog.com/movies/casa-blanca/. You might think you could get an archive of all recently added movies (just like the blog home is an archive of all recently added posts) by going to http://yourblog.com/movies/, but this isn’t supported out of the gate. You can do it without permalinks by going to http://yourblog.com/?post_type=movies, but even then, you’re forced to use the index.php template file in your theme. This plug-in enables archive permalinks (yourblog.com/movies), adds two new template files in the hierarchy (i.e. type-movies.php and type.php), and adds a new is_custom_post_type_archive conditional you can use in your theme!

What didn’t make it in this pre-1.0 release:

Please keep in mind that robust custom post type support is new to 3.0, and although this plug-in was aggressively tested, it’s hard to test it with all possible custom post type setups. For this reason, along with the bullets listed above, I’m considering this a “beta” – in the Google sense – or pre-1.0 release.

You’re welcome to use the code in your own custom post type plug-ins or themes (the code is GPL), but please include attribution to the author.

4 Replies

  1. A big thank you for this plugin, solved a problem I’ve been having for a few days and can’t seem to get a hold on, in two clicks. Headache gone. ;) (Not sure why I’m having the problem to begin with since I’m running 3.1.2, but by now I’m just glad that it’s gone! lol)

    AnnaMay 16, 2011 at 3:51 amReply
  2. Hi Jake,

    Thanks for the plugin. I installed this and was hoping to uninstall with an upgrade to WP >3.1, but whenever I deactivate the plugin my entire site doesn’t fetch anything bar the header…

    Any help would be appreciated :)

    Henry HoffmanJuly 11, 2011 at 1:28 amReply
  3. I am running into challenges with archive and category widget using multiple custom post types. They only seem to work with blog posts. I found some code to get them to work with ALL post types, but this is not ideal either. Do you have any insight or recommendation on how to work with this?

    CaseyAugust 18, 2011 at 5:28 pmReply
  4. thanks for this problem! solves quiet a few problem i struggled for some days!

    masixSeptember 25, 2011 at 7:25 amReply

Leave a Reply