WordPress.org

Support

Support » Plugins and Hacks » [Resolved] exclude posts in twenty twelve

[Resolved] exclude posts in twenty twelve

Viewing 1 replies (of 1 total)
  • Plugin Author ambrosite

    @ambrosite

    For the Twenty Twelve theme, it looks like single.php is the right file to edit, however simply adding that code will not work. You need to find the following lines:

    <span class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '&larr;', 'Previous post link', 'twentytwelve' ) . '</span> %title' ); ?></span>
    <span class="nav-next"><?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '&rarr;', 'Next post link', 'twentytwelve' ) . '</span>' ); ?></span>

    And replace them with this — be sure to put in the IDs of the posts you want to exclude:

    <span class="nav-previous">
    <?php previous_post_link_plus( array(
        'format' => '%link',
        'link' => '<span class="meta-nav">' . _x( '&larr;', 'Previous post link', 'twentytwelve' ) . '</span> %title',
        'ex_posts' => '1, 2'
    ) );?>
    </span>
    <span class="nav-next">
    <?php next_post_link_plus( array(
        'format' => '%link',
        'link' => '%title <span class="meta-nav">' . _x( '&rarr;', 'Next post link', 'twentytwelve' ) . '</span>',
        'ex_posts' => '1, 2'
    ) );?>
    </span>
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] exclude posts in twenty twelve’ is closed to new replies.