WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Custom Post Template] Filter Templates for Posts and Custom Post Types

[Plugin: Custom Post Template] Filter Templates for Posts and Custom Post Types

  • 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/

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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' );

    This was very helpful! Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Custom Post Template] Filter Templates for Posts and Custom Post Types’ is closed to new replies.