WordPress.org

Support

Support » Themes and Templates » Help with Twenty Twelve, custom post type and templates

Help with Twenty Twelve, custom post type and templates

  • critter88
    Member

    @critter88

    Hi,

    I’m following a Lynda.com course on WordPress and custom post types, there is some critical information which appears to be specific to Twenty Eleven, I was hoping for help in doing this in Twenty Twelve.

    I have created a custom post type, and I would like to change the single display page for the post type. The video says to change single.php (but the code is different) and then to create a file called content-<posttype>.php which is the file to make the display changes in.

    I don’t know much PHP, but the single.php file in Twenty Twelve seems to already call content-something.php depending on the post type, however I have tried creating a content-posttype.php file and it is ignored.

    If anyone could point me in the right direction or give me a link to some reference material it would be greatly appreciated.

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • critter88
    Member

    @critter88

    One further thing, right now I have made a file called single-<posttype>.php and modified the get_template_part call to call the content-<posttype>.php file.

    This seems to work although the get_template_part call in the original single.php must do something similar to this, because the other post types with with the content-<posttype>.php files without adding another single-<posttype>.php

    Michael
    Forum Moderator

    @alchymyth

    to change single.php (but the code is different) and then to create a file called content-<posttype>.php

    One further thing, right now I have made a file called single-<posttype>.php and modified the get_template_part call to call the content-<posttype>.php file.

    should work
    as long as you make sure that your <posttype> does not conflict with the <post_format> used in Twenty Twelve, as the content files are separated by post format; content-{post_format}.php

    critter88
    Member

    @critter88

    Thanks for your response alchymyth! 🙂

    I was getting confused between post formats and types, and I suppose naming the display file content-{post_type} is confusing as it matches the format for post formats, I expect it’s better to use a different structure.

    eliteclientele
    Member

    @eliteclientele

    critter88,

    I was doing the exact same thing with the tutorial, and ran into this problem. I just had to reset my permalinks.

    Go to settings -> permalinks -> save changes

    Thanks eliteclientele, I’ll keep that in mind.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Help with Twenty Twelve, custom post type and templates’ is closed to new replies.