Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I know I can use single-{posttype}.php but can I use something like single-{custom-post-type-slug}.php to target a specific custom post type post? Or is there another way like a custom template which I can select from the admin? It doesn't seem to work on custom post type edit sreen.

share|improve this question

1 Answer 1

Please refer to the Template Hierarchy.

Custom Post Types use two different template files, depending on context.

For custom post type single post display:

  • single-{posttype}.php
  • single.php
  • index.php

For custom post type archive display:

  • archive-{posttype}.php
  • archive.php
  • index.php

In both cases, {posttype} is the custom post type $slug, as-defined in the register_post_type( $slug, $args ) call.

share|improve this answer
    
This does not answer the question, sorry. I want to target specific cpt post, not the generic cpt template. –  Rade Oct 2 '13 at 13:51
    
Then you need to re-word your question to clarify exactly what you're after. single-{custom-post-type-slug}.php is quite unclear. Perhaps you mean single-{CPT-post-slug}.php? –  Chip Bennett Oct 2 '13 at 14:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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