I'd like to pre-define page_template choice in the page attributes when creating a new post in a custom post type.

Found lots to do with adding parents defaults, but stuck getting past that.


You need to create the template files within your theme using the correct naming.

Please see:


| improve this answer | |
  • I guess I wasn't clear - I want the template auto selected when I add a new post / page / custom post type. So under page attributes, my client doesn't have to keep selecting page template and selecting the custom template from the drop down box. – Simon Forster Jul 17 '17 at 12:37
  • 1
    Please take a look at: wordpress.stackexchange.com/questions/204657/… – heady12 Jul 17 '17 at 12:48

It's in the filename. single-$posttype.php, archive-$posttype.php

| improve this answer | |
  • maybe I wasn't too clear - I want the custom template, using the newer method of template identification that heady12 references above, auto selected when I click new page (or new custom post type) – Simon Forster Jul 17 '17 at 12:36
  • How many different templates do you need per post type (foo)? If it's one, call it single-foo.php, if it's more than one call the default single-foo.php and use the Template Post Type header in the others. – Chris Cox Jul 17 '17 at 13:01

As heady12 pointed out

Apply template to custom post type

With some modifications to conditions this worked.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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