WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Next page link on front page (8 posts)

  1. false1
    Member
    Posted 5 years ago #

    Hey folks

    I wonder if it's possible to have a next page link at the bottom of your front page? I have options set to display 10 posts on the front page. I'd like to put a link on the bottom to go to the next 10 posts and from that page forward to the next 10 or back to the previous 10. Is that possible? I haven't been able to find anything about it.

    thanks

  2. MichaelH
    Member
    Posted 5 years ago #

    If you were using the WordPress Default theme, you would see that the wp-content/themes/default/index.php file uses this code to do that:

    <div class="navigation">
    <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div>
    <div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div>
    </div>

    Resources:
    Template_Tags/previous_posts_link
    Template_Tags/next_posts_link
    Stepping Into Templates
    Stepping Into Template Tags
    Template Hierarchy

  3. false1
    Member
    Posted 5 years ago #

    Thanks MichaelH, it's not working though.

    I put the code you listed in the same place on my current theme as it appears in the default theme.

    I deleted this piece of code that was in my current theme because it seemed redundant:
    <div class="Nav"><?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?></div>

    The links appear but take me to the same posts. I don't go to the older posts.

    If I change my theme to the default the code works fine.

  4. ohblue
    Member
    Posted 5 years ago #

  5. MichaelH
    Member
    Posted 5 years ago #

    So it works fine with the Default theme so something in your theme is causing the problem.

    May need to post your index.php in a pastebin and report the link back here.

  6. false1
    Member
    Posted 5 years ago #

    I posted the code to this address: http://pastebin.com/m13ab8d76

    Ohblue I looked at that post. I am using query_posts. that string of code didn't help though. Thanks anyway.

  7. MichaelH
    Member
    Posted 5 years ago #

    If you delete this code:

    <?php
    if (is_home()) {
    query_posts("cat=-85");
    }
    ?>

    does it work?

  8. false1
    Member
    Posted 5 years ago #

    Yeah, it works now.

    I had to add this code to keep that category from displaying

    <?php if (in_category('85') && is_home() ) continue; ?>

    that query_posts is kinda particular, huh?

    thanks again

Topic Closed

This topic has been closed to new replies.

About this Topic