WordPress.org

Ready to get started?Download WordPress

Forums

Ambrosite Next/Previous Post Link Plus
[resolved] exclude posts in twenty twelve (2 posts)

  1. carboneum
    Member
    Posted 1 year ago #

    Hello,

    in which file i have to put the code:
    <?php next_post_link_plus( array('ex_posts' => '') ); ?>

    for exluding posts for the prev/next links?
    I put the code in the single.php and the functions.php
    but the link at the bottom of each post still is there.

    Thank you.

    http://wordpress.org/extend/plugins/ambrosite-nextprevious-post-link-plus/

  2. ambrosite
    Member
    Plugin Author

    Posted 1 year ago #

    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>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.