Support » Fixing WordPress » Custom Post Types in TwentyTwelve

  • 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!

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom Post Types in TwentyTwelve’ is closed to new replies.