0

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.

1 Answer 1

0

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.

2
  • This does not answer the question, sorry. I want to target specific cpt post, not the generic cpt template.
    – anlogg
    Commented Oct 2, 2013 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? Commented Oct 2, 2013 at 14:00

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.