I have created a page on which I would like to run queries exlusively for one custom post type in the same way I'm using Category.php, Author.php and index.php to run queries for regular posts. I can't seem to get anything to appear when I edit the page that is associated with the template I've created for this page, so I've edited the actual page template itself. This may or may not be related to the fact that I can't get this page to behave like index.php does, i.e. providing a running list of posts until someone does a more refined search such as by Category.

I'm stumped - how can I get a page template to work just like index.php does, but for the custom post type only?


1 Answer 1


You want to use the template file archive-{posttype}.php to output an archive index of your Custom Post Type, and the template file single-{posttype}.php to output a single Custom Post.

Refer to the Codex entry for Template Hierarchy.

  • Thanks, Chip. But I've got an unresolved issue with the system not reading my archive-{posttype}.php. It does read my single-{posttype}.php, however. It is registered appropriately, etc. I have to develop a workaround, so do you know if there's a way to have a page -running off of its own template (and I edited the template directly) for a custom post type, to act as index.php does (as the default template) for regular posts?
    – mktggirl
    Commented Jun 6, 2011 at 14:30
  • What version of WordPress are you using? IIRC, archive-{posttype}.php only works in WordPress 3.1+. Commented Jun 6, 2011 at 15:19
  • I'm using 3.1.3
    – mktggirl
    Commented Jun 6, 2011 at 16:59
  • What do you mean when you say that the system is "not reading" your "archive-{posttype}.php template file? Can you update your question to describe what's happening/not happening as you expect? What is your custom post type named (perhaps post the entire registration code)? What is your archive-{posttype}.php template file named? Also: if you put <?php post_type_archive_title(); ?> in your archive template file, does the Custom Post Type Title output? Commented Jun 6, 2011 at 17:15
  • 1
    "Would the latter serve as a destination URL where all queries of the custom post type 'Businesses Sold' could happen?" - YES! That is the purpose of the archive-{posttype}.php template file: to serve as the template file for rendering the archive index of Posts of the Custom Post Type. If you have a static Page of the same name, I honestly don't know how WordPress would handle that. Commented Jun 6, 2011 at 19:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.