Forums

Custom Post Template
Filter Templates for Posts and Custom Post Types (2 posts)

  1. jeffski
    Member
    Posted 5 months ago #

    I have a site using normal Posts and also set up my own Custom Post Types. I want to use different templates for normal Posts from what I use for Custom Posts.

    I added the function my_cpt_post_types(), as outlined in the Other Notes section, to get the template drop down to show on the Custom Post Page editor but is there a way to not show those templates on the normal Posts page editor?

    http://wordpress.org/extend/plugins/custom-post-template/

  2. jeffski
    Member
    Posted 4 months ago #

    Figured this out, in case anyone is interested:

    - Use array_shift() to remove the first item from the array which is 'post' and is added by default.

    - So your code would look more like:

    function my_cpt_post_types( $post_types ) {
        $post_types[] = 'movie';
        $post_types[] = 'actor';
        array_shift($post_types);
        return $post_types;
    }
    add_filter( 'cpt_post_types', 'my_cpt_post_types' );

Reply

You must log in to post.

About this Plugin

About this Topic