WordPress.org

Ready to get started?Download WordPress

Forums

Custom Post Template
[resolved] Custom Post Templates with Custom Post TYPES in WP 3.0 (9 posts)

  1. llaughy
    Member
    Posted 4 years ago #

    I have version 1.3 running with WP 3.0 and have set up a custom post type. The metabox with template file list shows up in regular posts, but not in my custom post type posts. Do I need to rename my template files to get them to work with my custom post type? Thanks!

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

  2. llaughy
    Member
    Posted 4 years ago #

    Update on Custom Post Template plugin:

    I have found that if you are using only your custom post type and not the standard post type, then a quick fix is to change ‘post’ in line 48 of custom-post-templates.php (the add_meta_box line) to the name of your post type.

    My configuration doesn’t need to use the standard post types, and I only want custom post templates for my custom post type. I don’t know enough php to make it show up on both at once, but does anyone know how that is done? Here is the line of code:

    $this->add_meta_box( 'select_post_template', __( 'Post Template', 'custom-post-templates' ), 'select_post_template', 'post', 'side', 'default' );

    Thanks!

  3. Andrea Pernici
    Member
    Posted 3 years ago #

    Substitute 'post' with 'your custom post type name'.

  4. deepwoods
    Member
    Posted 3 years ago #

    Thought I'd chime in and agree with the posters above, I just did this this morning and it works great. Just change 'post' to your custom name. Then it shows up on your custom post page and you can select what template you want to use.

  5. matrym
    Member
    Posted 3 years ago #

    Thanks for posting this solution. I'd really love to see the plugin be programmed to automatically apply to all custom post types. In lieu of that, it'd be cool to also be able to list multiple custom post types, etc.

  6. jeroenkl
    Member
    Posted 3 years ago #

    Great post! I was looking for this solution for a long time. Thanks!

  7. Mike Castro Demaria
    Member
    Posted 3 years ago #

    Hello,

    Thanks for this great plug-in !

    FYI : You can simply duplicate the n° 48 line to add your custom post typ name.

    $this->add_meta_box( 'select_post_template', __( 'Post Template', 'custom-post-templates' ), 'select_post_template', 'my_custom_post_name', 'side', 'default' );

    I think it will be better to have a simple config on backoffice who list all post type to be active. In this case, a simple loop who get the arry of the post type liste who add a meta box will be usefull.

    Maybe in a future version ?

  8. pnuker
    Member
    Posted 3 years ago #

    Didn't work for me. Still no dropdown...

  9. sylwiaofwarsaw
    Member
    Posted 3 years ago #

    Thanks for the tip. Worked like a charm!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic