Forums

Adding Next/Previous Links (3 posts)

  1. blong
    Member
    Posted 1 year ago #

    I would like to add next and previous links at the top of my post that stay within a certain category. I am using the theme twenty ten. What is the best way to do this? Thanks :)

  2. alchymyth
    The Sweeper
    Posted 1 year ago #

    edit single.php - the link tags are there already:

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

    (and same thing further down: <div id="nav-below" class="navigation">)

    then use the info from the docu:

    http://codex.wordpress.org/Function_Reference/next_post_link
    http://codex.wordpress.org/Function_Reference/previous_post_link

    see the 'in_same_cat' parameter

  3. blong
    Member
    Posted 1 year ago #

    Thank you so much! That document gave me exactly what I was looking for!

Topic Closed

This topic has been closed to new replies.

About this Topic