WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] next/previous post (12 posts)

  1. mindfeck
    Member
    Posted 8 years ago #

    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?

    http://www.mindfeck.info

    All help is greatly appreciated.

  2. moshu
    Member
    Posted 8 years ago #

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

  3. mindfeck
    Member
    Posted 8 years ago #

    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.

  4. moshu
    Member
    Posted 8 years ago #

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

  5. mindfeck
    Member
    Posted 8 years ago #

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

  6. moshu
    Member
    Posted 8 years ago #

    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.

  7. mindfeck
    Member
    Posted 8 years ago #

    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.

  8. mindfeck
    Member
    Posted 8 years ago #

    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?

  9. moshu
    Member
    Posted 8 years ago #

    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.

  10. mindfeck
    Member
    Posted 8 years ago #

    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.

  11. mindfeck
    Member
    Posted 8 years ago #

    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?

  12. moshu
    Member
    Posted 8 years ago #

    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:
    http://codex.wordpress.org/User:alphaoide/wp_powered_photoblog
    to get ideas how to "trick" WP to think your index is a single...

Topic Closed

This topic has been closed to new replies.

About this Topic