Title: Layout/Template Option Missing
Last modified: August 21, 2016

---

# Layout/Template Option Missing

 *  Resolved [kikimarie123](https://wordpress.org/support/users/kikimarie123/)
 * (@kikimarie123)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/layouttemplate-option-missing/)
 * I’ve read through several other posts but have not been able to figure this out.
 * Where is the layout/template option? On my normal “add new post” page there is
   an option to select a different layout/template. I have different post templates
   that I would like the option to select when I create a new post in the custom
   posts UI.
 * Please help!
 * [http://wordpress.org/extend/plugins/custom-post-type-ui/](http://wordpress.org/extend/plugins/custom-post-type-ui/)

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [12 years, 12 months ago](https://wordpress.org/support/topic/layouttemplate-option-missing/#post-3768623)
 * That dropdown along the right of your post editor would be something from your
   theme itself. It’s provided enough flexibility in the layouts to offer that as
   an option. However, there is no way it could predict future post types that you
   created. It’s really dependent on the theme more than this plugin.
 * The closest I can think of that WOULD be related to our plugin here is if you
   don’t have the “Page Attributes” option checked in the advanced options area 
   for the Custom Post Type. That’s the one that controls that area on the right.
 *  Thread Starter [kikimarie123](https://wordpress.org/support/users/kikimarie123/)
 * (@kikimarie123)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/layouttemplate-option-missing/#post-3768639)
 * That makes sense. I’m not too advanced with my php knowledge so any chance you
   can help me decipher how to add that in? Here is the code from my theme calling
   the layout via a custom meta box.
 *     ```
       /**
        * Get current layout
        */
       function responsive_get_layout() {
       	/* 404 pages */
       	if ( is_404() ) {
       		return 'default';
       	}
       	$layout = '';
       	/* Get Theme options */
       	global $responsive_options;
       	$responsive_options = responsive_get_options();
       	/* Get valid layouts */
       	$valid_layouts = responsive_get_valid_layouts();
       	/* For singular pages, get post meta */
       	if ( is_singular() ) {
       		global $post;
       		$layout_meta_value = ( false != get_post_meta( $post->ID, '_responsive_layout', true ) ? get_post_meta( $post->ID, '_responsive_layout', true ) : 'default' );
       		$layout_meta = ( array_key_exists( $layout_meta_value, $valid_layouts ) ? $layout_meta_value : 'default' );
       	}
       	/* Static pages */
       	if ( is_page() ) {
       		$page_template = get_post_meta( $post->ID, '_wp_page_template', true );
       		/* If custom page template is defined, use it first */
       		if ( 'default' != $page_template ) {
       			if ( in_array( $page_template, array( 'blog.php', 'blog-excerpt.php' ) ) ) {
       				$layout = $responsive_options['blog_posts_index_layout_default'];
       			} else {
       				$layout = $responsive_options['static_page_layout_default'];
       			}
       		}
       		/* Else, if post custom meta is set, use it */
       		else if ( 'default' != $layout_meta ) {
       			$layout = $layout_meta;
       		}
       		/* Else, use the default */
       		else {
       			$layout = $responsive_options['static_page_layout_default'];
       		}
       	}
       	/* Single blog posts */
       	else if ( is_single() ) {
       		/* If post custom meta is set, use it */
       		if ( 'default' != $layout_meta ) {
       			$layout = $layout_meta;
       		}
       		/* Else, use the default */
       		else {
       			$layout = $responsive_options['single_post_layout_default'];
       		}
   
       	}
       	/* Posts index */
       	else if ( is_home() || is_archive() || is_search() ) {
       		$layout = $responsive_options['blog_posts_index_layout_default'];
       	}
       	/* Fallback */
       	else {
       		$layout = 'default';
       	}
       	return apply_filters( 'responsive_get_layout', $layout );
       }
   
       /**
        * Get valid layouts
        */
       function responsive_get_valid_layouts() {
       	$layouts = array(
       		'content-sidebar-page' => __( 'Content/Sidebar', 'responsive' ),
       		'sidebar-content-page' => __( 'Sidebar/Content', 'responsive' ),
       		'content-sidebar-half-page' => __( 'Content/Sidebar Half Page', 'responsive' ),
       		'sidebar-content-half-page' => __( 'Sidebar/Content Half Page', 'responsive' ),
       		'full-width-page' => __( 'Full Width Page (no sidebar)', 'responsive' ),
       	);
       	return apply_filters( 'responsive_valid_layouts', $layouts );
       }
   
       /**
        * Add Layout Meta Box
        *
        * @link	http://codex.wordpress.org/Function_Reference/_2			__()
        * @link	http://codex.wordpress.org/Function_Reference/add_meta_box	add_meta_box()
        */
       function responsive_add_layout_meta_box( $post ) {
       	global $post, $wp_meta_boxes;
   
       	$context = apply_filters( 'responsive_layout_meta_box_context', 'side' ); // 'normal', 'side', 'advanced'
       	$priority = apply_filters( 'responsive_layout_meta_box_priority', 'default' ); // 'high', 'core', 'low', 'default'
   
           add_meta_box(
       		'responsive_layout',
       		__( 'Layout', 'responsive' ),
       		'responsive_layout_meta_box',
       		'post',
       		$context,
       		$priority
       	);
       }
       // Hook meta boxes into 'add_meta_boxes'
       add_action( 'add_meta_boxes', 'responsive_add_layout_meta_box' );
   
       /**
        * Define Layout Meta Box
        *
        * Define the markup for the meta box
        * for the "layout" post custom meta
        * data. The metabox will consist of
        * radio selection options for "default"
        * and each defined, valid layout
        * option for single blog posts or
        * static pages, depending on the
        * context.
        *
        * @uses	responsive_get_option_parameters()	Defined in \functions\options.php
        * @uses	checked()
        * @uses	get_post_custom()
        */
       function responsive_layout_meta_box() {
       	global $post;
       	$custom = ( get_post_custom( $post->ID ) ? get_post_custom( $post->ID ) : false );
       	$layout = ( isset( $custom['_responsive_layout'][0] ) ? $custom['_responsive_layout'][0] : 'default' );
       	$valid_layouts = responsive_get_valid_layouts();
       	?>
       	<p>
       	<input type="radio" name="_responsive_layout" <?php checked( 'default' == $layout ); ?> value="default" />
       	<label><?php _e( 'Default', 'responsive' ); ?></label><br />
       	<?php foreach ( $valid_layouts as $slug => $name ) { ?>
       		<input type="radio" name="_responsive_layout" <?php checked( $slug == $layout ); ?> value="<?php echo $slug; ?>" />
       		<label><?php echo $name; ?></label><br />
       	<?php } ?>
       	</p>
       	<?php
       }
   
       /**
        * Validate, sanitize, and save post metadata.
        *
        * Validates the user-submitted post custom
        * meta data, ensuring that the selected layout
        * option is in the array of valid layout
        * options; otherwise, it returns 'default'.
        *
        * @link	http://codex.wordpress.org/Function_Reference/update_post_meta	update_post_meta()
        *
        * @link	http://php.net/manual/en/function.array-key-exists.php			array_key_exists()
        *
        * @uses	responsive_get_option_parameters()	Defined in \functions\options.php
        */
       function responsive_save_layout_post_metadata(){
       	global $post;
       	if ( ! isset( $post ) || ! is_object( $post ) ) {
       		return;
       	}
       	$valid_layouts = responsive_get_valid_layouts();
       	$layout = ( isset( $_POST['_responsive_layout'] ) && array_key_exists( $_POST['_responsive_layout'], $valid_layouts ) ? $_POST['_responsive_layout'] : 'default' );
   
       	update_post_meta( $post->ID, '_responsive_layout', $layout );
       }
       // Hook the save layout post custom meta data into
       // publish_{post-type}, draft_{post-type}, and future_{post-type}
       add_action( 'publish_post', 'responsive_save_layout_post_metadata' );
       add_action( 'publish_page', 'responsive_save_layout_post_metadata' );
       add_action( 'draft_post', 'responsive_save_layout_post_metadata' );
       add_action( 'draft_page', 'responsive_save_layout_post_metadata' );
       add_action( 'future_post', 'responsive_save_layout_post_metadata' );
       add_action( 'future_page', 'responsive_save_layout_post_metadata' );
       ```
   
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [12 years, 12 months ago](https://wordpress.org/support/topic/layouttemplate-option-missing/#post-3768708)
 * It looks like the Responsive theme sets layout stuff via custom fields and post
   meta. For that, you’d need to make sure your post type supports them as well.
 *  Thread Starter [kikimarie123](https://wordpress.org/support/users/kikimarie123/)
 * (@kikimarie123)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/layouttemplate-option-missing/#post-3768727)
 * I found my own solution. For anyone else who is curious…
 * Read this…
 * [http://codex.wordpress.org/Post_Type_Templates](http://codex.wordpress.org/Post_Type_Templates)
 * For single-{post_type}.php {post_type} is whatever you have listed under the “
   name” section the in plugin’s post types.
 * Hope this will save others time!
 *  [AliZee](https://wordpress.org/support/users/alizee/)
 * (@alizee)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/layouttemplate-option-missing/#post-3768889)
 * I am having the same problem! Not sure how to solve it!
    even tho just yesterday
   I was able to see theme features on a newly created post! All a sudden it all
   disappeared!
 * kikimarie123 , can you tell me more about what you’ve done to solve this issue!
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [12 years, 7 months ago](https://wordpress.org/support/topic/layouttemplate-option-missing/#post-3768890)
 * AliZee, as long as your CPTs, registered through CPT UI or not, has ‘Page Attributes’
   in the supports parameter, and is hierarchical, I believe you should be seeing
   the dropdown menu on the right for template selection. Whether your current theme
   has any custom templates, I can’t say. As kikimarie123 pointed out in her last
   post, you can also create a single-{$post_type}.php file with the {$post_type}
   being the chosen slug, and that template will get used when viewing individual
   posts in your post type.
 *  [azaj_00199](https://wordpress.org/support/users/azaj_00199yahooin/)
 * (@azaj_00199yahooin)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/layouttemplate-option-missing/#post-3768893)
 * how to add Template Selection option to my custom post type plugin please help
   me solve this query ……..
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [12 years, 2 months ago](https://wordpress.org/support/topic/layouttemplate-option-missing/#post-3768894)
 * azaj_00199 from most of what I’ve seen, WordPress doesn’t really do much for 
   providing easily assigned custom template for custom post types the same way 
   they do with the “page” post type.
 * You can see some more information about template hierarchy here [https://codex.wordpress.org/Template_Hierarchy](https://codex.wordpress.org/Template_Hierarchy)

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Layout/Template Option Missing’ is closed to new replies.

 * ![](https://ps.w.org/custom-post-type-ui/assets/icon-256x256.png?rev=2744389)
 * [Custom Post Type UI](https://wordpress.org/plugins/custom-post-type-ui/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/custom-post-type-ui/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/custom-post-type-ui/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-post-type-ui/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-post-type-ui/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-post-type-ui/reviews/)

## Tags

 * [custom posts](https://wordpress.org/support/topic-tag/custom-posts/)
 * [layout](https://wordpress.org/support/topic-tag/layout/)
 * [template](https://wordpress.org/support/topic-tag/template/)

 * 8 replies
 * 4 participants
 * Last reply from: [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * Last activity: [12 years, 2 months ago](https://wordpress.org/support/topic/layouttemplate-option-missing/#post-3768894)
 * Status: resolved