WordPress.org

Ready to get started?Download WordPress

Forums

Custom Post Types in TwentyTwelve (5 posts)

  1. @starscythe
    Member
    Posted 1 year ago #

    Hi,

    I'm trying to work out how to add a custom post type to my website but when it gets to the part where I need to add it to a template I can't work out what to do. After using TwentyTen forever I've started using TwentyTwelve as my theme template and I find it hard to work out what goes where more.

    So... I have made my custom post type 'spoilers' using the following code in my functions.php:

    register_post_type('spoilers', array(
    'label' => 'spoilers',
    'public' => true,
    'show_ui' => true,
    'capability_type' => 'post',
    'hierarchical' => false,
    'rewrite' => array('slug' => 'spoilers'),
    'query_var' => true,
    'supports' => array(
    'title',
    'editor',
    'excerpt',
    'trackbacks',
    'custom-fields',
    'comments',
    'revisions',
    'thumbnail',
    'author',
    'page-attributes',)
    ) );

    Then I created a page template 'page-spoilers.php' and added this:

    <?php query_posts( 'post_type=spoilers'); ?>

    before the 'have posts' php.

    I set the page I wanted it to show up on to the right template and my custom post type posts show up fine.

    However, how can I make them click through to a single page? and how to I get pagination to show at the bottom after say 10 posts or so?

    I know enough to get by, but I'm not very php savvy... is there any way someone might be able to explain how to do this, to someone dumb? As simple as possible would be great!

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    Are you using a child theme?

  3. @starscythe
    Member
    Posted 1 year ago #

    Nope, no child theme.

  4. esmi
    Forum Moderator
    Posted 1 year ago #

    Do not edit the Twenty Twelve theme. It is the current default WordPress theme and having access to an original, unedited, copy of the theme is vital in many situations. First create a child theme for your changes.

  5. @starscythe
    Member
    Posted 1 year ago #

    Ok... then what do I do to solve my custom post type issues?

Topic Closed

This topic has been closed to new replies.

About this Topic