

I decided to add this feature because one, generally, wants to be able to view all the posts of a custom post type. So if you have a custom post type named ‘Acme Products’, you can view all the products of this type by visiting example.com/acme-products/ in the browser.


/* Template Name: Custom Post Type Archive */

//somewhere in the template file 
global $query_string; 


'has_archive' => true



'has_archive' => true

and your archive will be accessible at example.com/music/ or example.com/country_music

And when you want to disable the archive, simply set

'has_archive' => false



3 thoughts on “Custom post type archives with WordPress Cuztom Helper

  1. The problem with the whole archives template thing is that with custom post types we are supposedly creating custom data, and data structures. So creating a custom post type named news that looks the same as your blog, and indeed defaults back to the default blog archive template, may as well be a catagory.

    Why custom page templates for custom post types are a lot more powerful is that they allow you to create a page template that contains “meta content” about your custom data and allows the users a lot more control if we customize the admin and front end for flexibility and ease of use around the new data.

  2. @Paul: How I understand it is that archive template is just a specific page template intended to serve the specific purpose of an archive. It can do whatever a page template can do with regards to any custom post type data.

    As an analogy, if one has a generic mold that can be tweaked to create different objects and a mold that can be used as is to create a certain object called ‘A’, one would use A’s mold to create object A rather than tweaking and using generic mold to create object A, instead.

    That being said, creating a custom post type certainly makes sense only when you need something that doesn’t fit in the context provided by the default ‘Post’ type. Defaulting to the already present archive.php in absence of a specific archive-post_type.php is just a given for the title and editor features of a custom post type.

  3. Hi guys,

    Nice to see you two found eachother. It happens to be, we all worked on Cuztom Helper.

    @Abhinav: Thanks for implemting this feature to Cuztom Helper. At first, I didn’t see the point, but now I see the advantage of this (little) feature.

Contribute to the Discussion
