WordPress.org

Ready to get started?Download WordPress

Forums

How to add « Previous Page — Next Page » (6 posts)

  1. MoonbatWingnut
    Member
    Posted 6 years ago #

    Hello,

    I found this:

    http://codex.wordpress.org/Template_Tags/posts_nav_link

    And it says to use this code:

    <?php posts_nav_link(); ?>

    to display:

    « Previous Page — Next Page »

    but I don't know where to put that code.

    I'd appreciate a little help,

    Thanks.

    TW

  2. MoonbatWingnut
    Member
    Posted 6 years ago #

    I put this code "<?php posts_nav_link(); ?>" near the bottom of the page.php file here:

    <?php
    } // End the Loop
    ?>
    </div>
    </div> <!-- #primary -->
    <?php posts_nav_link(); ?> /* added to get page navigation, I hope */
    </div>

    <div id="rightcolumn">

    But it doesn't work. Can someone tell me how to use this feature please?

    Thanks,

    TW

  3. moshu
    Member
    Posted 6 years ago #

    page.php is used to diaplay your Pages (as opposed to your posts). Which means you are putting the template tag in the wrong file.

    The first line i that article says:

    Displays links for next and previous pages. Useful for providing "paged" navigation of index, category and archive pages.

    Now we just have to find out what template files are used to display index, category and archives > Template_Hierarchy.

  4. MoonbatWingnut
    Member
    Posted 6 years ago #

    Ah, thanks, I keep forgetting about the special meaning of the word 'page'. I got it to work by placing the code in the footer.php file. But it sure seems backwards to have older posts pointed to the right and newer posts pointed to the left.

    Thanks!

    TW

  5. moshu
    Member
    Posted 6 years ago #

    According to the Codex for older posts should point to the left... but you never know :)

  6. MoonbatWingnut
    Member
    Posted 6 years ago #

    Huh?

    The Codex says:

    "WordPress defines "next page" as the "next page toward the past"."

    « Previous Page — Next Page »

    So older posts are pointed to as being to the right, or am I missing something? And is there a way to reverse it?

Topic Closed

This topic has been closed to new replies.

About this Topic