WordPress.org

Ready to get started?Download WordPress

Forums

'in_same_cat' (2 posts)

  1. Seb Syd
    Member
    Posted 3 years ago #

    Here is the php previous_post_link, php next_post_link code for twenty ten in single.php template.

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

    How do I make the articles 'paginate to their category rather than all posts show?

    I have tried putting in 'in_same_cat' / $in_same_cat = true in various forms but can't workout how to get the result I want.

    Bellingen Museum

    Any Ideas, thanks.

  2. alchymyth
    Forum Moderator
    Posted 3 years ago #

    <div id="nav-above" class="navigation">
    					<div class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '&larr;', 'Previous post link', 'twentyten' ) . '</span> %title', true ); ?></div>
    					<div class="nav-next"><?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '&rarr;', 'Next post link', 'twentyten' ) . '</span>', true ); ?></div>
    				</div><!-- #nav-above -->

    'in_same_cat' is the third parameter in the function;
    http://codex.wordpress.org/Function_Reference/next_post_link

    the first is 'format' which is '%link'

    the second is 'link' which is '%title <span class="meta-nav">' . _x( '&rarr;', 'Next post link', 'twentyten' ) . '</span>'

Topic Closed

This topic has been closed to new replies.

About this Topic