Support » Themes and Templates » problems w next_post and previous_post in almost spring

  • Resolved Lori


    I love the Almost Spring template, but before I start tweaking it I need to find out if the navigation options work. I’d like to put next_post and previous_post links at the top of all but the index page, but no matter what I try I can’t get it to work at all. On another blog I have (based on the “classic” theme), it was easy to get working, but with Almost Spring I can’t get any links to show no matter what I try — I’ve tried most of the alternatives here:

    The problem blog is here:

    Massively grateful for any help or advice.

    (I would post my code here, but this is my first time posting here, and I’m not sure what “backticks” are. There’s no preview function so I’m worried that it would look horrible…)


Viewing 7 replies - 1 through 7 (of 7 total)
  • Just go back to the Codex page you linked to and read aloud (3 times) the Description section.

    Thanks for looking in so quickly, Moshu. From that page it seems like I was barking up the wrong tree with next_post() etc.

    I’m not sure I’ve been able to explain what I actually wnat to do. If I want to have something like

    << previous post | home | next post >> at the top of individual post pages, which template tags should I use, and where should I put them?

    As an experiment I tried putting this

    <div style=”text-align:center;”>
    <?php posts_nav_link(‘ · ‘, ‘previous page’, ‘next page’); ?>

    after this
    <div class=”post” id=”post-<?php the_ID(); ?>”>

    in index.php

    But nothing shows up…

    Apologies in advance for extremely ugly code…


    “individual posts” are NOT displayed by the index.php, unless your theme is lacking all the additional template files.
    (see Template Hierarchy > )

    The single post view – as we call it – usually is displayed by using the (surprize!) single.php template file.
    That’s the one you want to edit.

    (Note. Classic doesn’t have any additonal template files, that’s why it worked editing the index 🙂

    I haven’t tested this but it’s a good place to start:

    <div class="post_nav">
    <?php next_posts_link('&laquo; Previous Entries | ') ?><a href="<?php echo get_settings('home'); ?>/">Home</a><?php previous_posts_link(' | Next Entries &raquo;') ?>


    There is currently nothing on the page that the codex search returns when you search for these tags but I pulled from the default theme. I did change the html a bit so they all stay on the same line. Let me know if it works for you.

    Thanks a lot! That really helped and I’m on the right track now. 🙂


    Ryan, just for the record (and to avoid confusing later readers):
    the next_post tag and the next_posts_link are two different things!
    The first should be used on single post view (usually for single.php) and the other one is to be used on index, archive – wherever more posts are listed.

    Thanks, good to know. I’ll read up on the former.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘problems w next_post and previous_post in almost spring’ is closed to new replies.