Page template with CPT UI

Hi, I was following this thread: https://theme.co/apex/forum/t/display-page-template-option-for-custom-post-cpt-ui/27237/8

The suggestion was to copy the template files located in the root theme file the child theme and to add this code;

<?php
/*
Template Name: Blank - No Container | Header, No Footer
Template Post Type: post, page, product, custom post name here
*/

I have tried, but did not get any result.

The Original Page template looks like this:

<?php

// =============================================================================
// TEMPLATE NAME: Blank - Container | Header, Footer
// -----------------------------------------------------------------------------
// A blank page for creating unique layouts.
//
// Content is output based on which Stack has been selected in the Customizer.
// To view and/or edit the markup of your Stack's index, first go to "views"
// inside the "framework" subdirectory. Once inside, find your Stack's folder
// and look for a file called "template-blank-1.php," where you'll be able to
// find the appropriate output.
// =============================================================================

?>

<?php x_get_view( x_get_stack(), 'template', 'blank-1' ); ?>

I have tried this:

<?php

// =============================================================================
// TEMPLATE NAME: Blank - Container | Header, Footer
// -----------------------------------------------------------------------------
// A blank page for creating unique layouts.
//
// Content is output based on which Stack has been selected in the Customizer.
// To view and/or edit the markup of your Stack's index, first go to "views"
// inside the "framework" subdirectory. Once inside, find your Stack's folder
// and look for a file called "template-blank-1.php," where you'll be able to
// find the appropriate output.
// =============================================================================

?>

<?php x_get_view( x_get_stack(), 'template', 'blank-1' ); ?>

<?php
/*
Template Name: Blank - Container | Header, Footer
Template Post Type: post, page, product, wines
*/

And this:

<?php

// =============================================================================
// TEMPLATE NAME: Blank - Container | Header, Footer
// Template Post Type: post, page, product, wines
// -----------------------------------------------------------------------------
// A blank page for creating unique layouts.
//
// Content is output based on which Stack has been selected in the Customizer.
// To view and/or edit the markup of your Stack’s index, first go to “views”
// inside the “framework” subdirectory. Once inside, find your Stack’s folder
// and look for a file called “template-blank-1.php,” where you’ll be able to
// find the appropriate output.
// =============================================================================

?>

<?php x_get_view( x_get_stack(), 'template', 'blank-1' ); ?>

I have enabled Page Attributes in the CPT.
Can you tell me what am I doing wrong, please, if you can spot it?

Thank you!

Hi There,

Please create this file: x-child/template-cpt.php

And the code should be like this:

<?php

// =============================================================================
// TEMPLATE NAME: CPT Blank - Container | Header, Footer
// -----------------------------------------------------------------------------
// A blank page for creating unique layouts.
//
// Content is output based on which Stack has been selected in the Customizer.
// To view and/or edit the markup of your Stack's index, first go to "views"
// inside the "framework" subdirectory. Once inside, find your Stack's folder
// and look for a file called "template-blank-1.php," where you'll be able to
// find the appropriate output.
// =============================================================================

?>

<?php x_get_view( x_get_stack(), 'template', 'blank-1' ); ?>

Hope it helps :slight_smile:

Hi, thanks!

I think I was not clear enought.

I need the Post attributes dropdown to appear in my Custom post’s sidebar, where I can select Blank - No container | Header, Footer template for it.

I know that latest WordPress supports this, with something like Template Post Type: post, page, product, custom post name here.
But I cannot figure out where to add this code.

Hope this clarifies it. Thanks again!

Hello there,

You will need to duplicate and modify the templates from your theme’s root directory to achieve the posts and custom post types. Please check out the links provided by my colleague, specifically this:

The steps on the link above was referring to Twenty Seventeen theme. For your setup, you need to modify the template files.

Hope this helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.