I have a custom post type called location. I would like to be able to use 2 different templates for this custom post type and select it via the page attributes box. I have a template set up and can select it when I'm editing a Page, but not when I am editing a custom post type. I can't find any information on how to enable this. I want to enable the dropdown select for all the custom post types, not just one.

  • 1
    template exists only for post type page. for custom post type you have to do everything by yourself : creating the metabox in the backoffice, saving the value et generating the public page with the selected template
    – mmm
    Commented Jul 13, 2016 at 17:21
  • Thanks, that's given me an idea. I can pull in a template part depending on the category selected.
    – MrFox
    Commented Jul 14, 2016 at 8:24

2 Answers 2


Since WordPress version 4.7 Post-Type-Templates are enabled in the WordPress core.

That means that you can create multiple templates for the single post-type view as for pages.

For this you just need to edit the single post/type template, and add something like this to the top of the file:

Template Name: Custom Type Template 
Template Post Type: post, product, custom-type 

On the line Template Post Type you just add your custom post type slug.
So this template will be available on the post, product and custom-type post type.

I already answered this here.
Read more about post-type-templates of WP 4.7 here.


Ok as mmm has pointed out that I can't do the dropdown select of templates on custom post types I have put this code in my single-cpt.php

global $post; 
if ( ( $post->post_type == 'location' ) && has_term( 'news', 'highlights' ) ) { 

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.