WordPress.org

Ready to get started?Download WordPress

Forums

Label "previous" and "next" post links? (3 posts)

  1. gamebynight1
    Member
    Posted 1 year ago #

    Hello,

    I am using the Skirmish theme. When viewing single posts, underneath the content are links to previous and next posts. These are simply hyperlinks left and right aligned. You can see an example below the content at this link. I would like to add the text "Previous Post:" and "Next Post:" to precede the post title links. I am unsure of how to do this. The code in my template-tags.php is the following:

    <?php if ( is_single() ) : // navigation links for single posts ?>
    
    		<?php previous_post_link( '<div class="nav-previous">%link</div>', '<span class="meta-nav">' . _x( '', 'Previous post link', 'skirmish' ) . '</span> %title' ); ?>
    		<?php next_post_link( '<div class="nav-next">%link</div>', '%title <span class="meta-nav">' . _x( '', 'Next post link', 'skirmish' ) . '</span>' ); ?>

    Can anyone share with me how I could add the Previous Post:/Next Post: text before the actual link?

    Thanks!

  2. riversatile
    Member
    Posted 1 year ago #

    Hi,

    Try that... This will add '«« Previous Post' and 'Next Post »»' above the both links.
    Demo for your blog here : http://www.monsterup.com/upload/1355478461814.png

    Just before %link, add :
    &laquo;&laquo; Previous Post<br />
    for previous_post_link

    and Just before %link, add :
    Next Post &raquo;&raquo;<br />
    for next_post_link

    Like this (copy/paste this to overwrite) :

    <?php if ( is_single() ) : // navigation links for single posts ?>
    
    		<?php previous_post_link( '<div class="nav-previous">&laquo;&laquo; Previous Post <br />%link</div>', '<span class="meta-nav">' . _x( '', 'Previous post link', 'skirmish' ) . '</span> %title' ); ?>
    		<?php next_post_link( '<div class="nav-next">Next Post &raquo;&raquo;<br />%link</div>', '%title <span class="meta-nav">' . _x( '', 'Next post link', 'skirmish' ) . '</span>' ); ?>
  3. gamebynight1
    Member
    Posted 1 year ago #

    Thank you, Riversatile. That accomplished exactly what I was looking for :-)

Topic Closed

This topic has been closed to new replies.

About this Topic