WordPress.org

Support

Support » Plugins and Hacks » Hacks » content template (post format) for custom post type

content template (post format) for custom post type

  • Hi,

    I want to add custom post type for the blog page.
    But I want this posts to use there own template.

    I though that the easy way is to add “content-my_post_type.php” to my theme.
    But of course it dosen’t work.

    Any idea how to hack this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello,
    Did you find an answer ?
    If yes, I’m interested.
    Thank you

    Hej

    Yes I did.

    I added file with the name content-.php

    with the following code:

    $templates = array();
    $templates[] = "content-{$post->post_type}.php";
    $templates[] = "content.php";
    locate_template($templates, true, false);

    and then content-posttype.php works!!!!!

    Let me know if it works for you,as this is untested live yet.

    Koff

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘content template (post format) for custom post type’ is closed to new replies.