WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. jeffski
    Member
    Posted 2 years 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 2 years 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' );
  3. jdawkinsatl
    Member
    Posted 2 years ago #

    This was very helpful! Thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic