Support » Fixing WordPress » next/previous post

  • Resolved mindfeck


    I would like to have a next/previous post link on my main page and on each of my posts to get the next or previous post chronologically. Right now, on the main page there are links to go to an archive of the previous or next day.

    Also, when navigating to an archive day, month, or year, it lists the titles but not the content. How can I make the content appear too?

    All help is greatly appreciated.

Viewing 11 replies - 1 through 11 (of 11 total)
  • 1. On main page (aka index) where normally more posts are listed/displayed – the next/prev link is just a “pagination” to not show zillion posts on a long-long page.
    2. Since you have set to show 1 (one) post on your index – the prev/next will show the same amount of posts = 1.
    3. The “Archive” title comes with your theme; never seen before
    4. Links to the previous and next post are displayed (normnally) on the single post view.

    5. Switch to another theme (just for testing) and set the # of posts to something higher than 1 – and you’ll see that everything you are asking for is working in an out-of-the-box WP install.

    EDIT. And never double post – I am very inclined to delete duplicate posts…

    I realized on the first post that I left out some info and I didn’t know how to edit it, sorry.

    I found in theloop.php how to make the archive pages show the content. My only question remains in how to get a previous post link on the single posts. I don’t see any links there.

    Check out the Default theme’s single.php file to see how it is done.

    I know how it’s done, I just don’t know where to post the code.

    Obviously in the single.php template file … where you want the links to appear. THat’s why I suggested to take a look at it in other themes.

    I put it in what seems to be the right place, but the text is not a link. It is only a link if I put it before …?php include (TEMPLATEPATH . ‘/theloop.php’); ?>
    but that messes up the layout.

    Okay I changed it from “div class=alignleft” to “div align=left” and that made the links work, but now the previous/next links are on different lines. What should I do?

    Two divs will never be on the same line… unless you do a little work around them.
    Since in the Deafult this problem is solved (you just have to look at it, as I suggested above), I don’t understand why don’t you follow the advice: Study how it is done in other themes and apply the solution to your theme.

    Well because it didn’t work as it did in the default, I had to change the div code, and now it doesn’t look right.

    And I want to have the previous/next post links on the front page too, not just the single post. How do I do that?

    because it didn’t work as it did in the default
    That’s probably because you have to look at the style.css file, too – to achieve the same effect 😉

    And I want to have the previous/next post links on the front page too
    Out of the box that doesn’t work. The Wp engine recognizes whether it’s an index or a single post view and doesn’t let you use single-specific code on index.
    See this Codex page:
    to get ideas how to “trick” WP to think your index is a single…

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘next/previous post’ is closed to new replies.