Reply To: Possible to assign different layouts?

Home Support TotalPress Possible to assign different layouts? Reply To: Possible to assign different layouts?

#76638

Thomas
Founder/Lead Dev

Hi Donny,

You’re killing me, you realize this right? You’re killing me and on a Sunday too…lol, I’m kidding.

Anywho, there is no way to determine what kind of custom post types any user will need or use if they choose to use a theme I have developed. So to make this easier for end users, and user’s, WordPress made it possible to assign page templates to custom post types since 4.7. Here is the instructions from the theme developers handbook: https://developer.wordpress.org/themes/template-files-section/page-template-files/#creating-page-templates-for-specific-post-types

So if you go into wp-content/themes/totalpress/page-templates and open up sidebar-content.php you will see the folowing at the top:

/**
 * Template Name: Sidebar | Content
 * Template Post Type: post, page, aside, audio, chat, gallery, image, link, quote, status, video
 */

This means that the template is available to all of those post types.

So, in order to get it to work with the custom post type your dealing with, you would change that to something like this:

/**
 * Template Name: Sidebar | Content
 * Template Post Type: post, page, aside, audio, chat, gallery, image, link, quote, status, video, <code>your-custom-post-type-goes-here</code>
 */

This should make the template available to those custom post types. Of course you would have to copy the page-templates folder into your child theme (at least I hope you’re using a child theme) then do that.

I hope this helps. Please let me know.