• Resolved micasuh

    (@micasuh)


    This plugin is great and has served me well for one project. However, now with growing needs from the client, I need to update some capabilities.

    I assume I successfully changed the capability type to be like a page rather than a post:
    https://i.imgur.com/IR8xd.png?1
    (although every time I save, it reverts back to showing as post rather than page)

    The reason I want the CPTs to be like a page is to allow the ability to choose different templates. However, as you can see, it does not give me the option to choose a different template:
    https://i.imgur.com/b9JkJ.png

    What can I do to make the template options show up? I’m at a loss for what I should do next.

    https://www.ads-software.com/extend/plugins/custom-post-type-ui/

Viewing 2 replies - 1 through 2 (of 2 total)
  • This got me curious since I might want to use page templates with a CPT with ‘page’ capabilities.

    I am seeing a similar thing: my CPT has these args (among others):

    'capability_type' => 'page',
    'hierarchical' => true,
    'supports' => array('title','editor','custom-fields','page-attributes'),

    But the page template dropdown is not showing up in the “Page Attributes” box, in fact the box title is only “Attributes”.

    hmmmm … I just did some code snooping and found this bit of logic in the core file \wp-admin\includes\meta-boxes.php (line 577 of wp-version 3.4.2)

    if ( 'page' == $post->post_type && 0 != count( get_page_templates() ) ) {
    ... show the "Template" dropdown ... }

    That $post->post_type is the name of the database field and the value must be literally ‘page’ for this to show up. So if I understand this correctly, my ‘cpt-page’ will never have that Template dropdown!

    I’m starting to think that the custom page templates to show my custom post types need to be of the kind described on these two Codex pages:
    https://codex.www.ads-software.com/Post_Type_Templates and
    https://codex.www.ads-software.com/Template_Hierarchy

    Hopefully some guru like the writer of this plugin will dive in to enlighten us. ??

    Thread Starter micasuh

    (@micasuh)

    After going to the IRC channel for #wordpress, someone found this plugin which seems to do what I want. It’s the best solution I could find.

    https://www.ads-software.com/extend/plugins/custom-post-template/

    In order to make it work for CPTs, you have to enter a custom function into the functions.php file. It lists the instructions on the Other Notes tab.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom post types as pages with different templates?’ is closed to new replies.