WordPress.org

Ready to get started?Download WordPress

Forums

next_posts_link page/2 is blank (5 posts)

  1. bsummer
    Member
    Posted 5 years ago #

    I'm trying to use the next_posts_link to navigate through pages of posts, but the link it creates (domain/category/newsletter/page/2) leads to a blank page.

    What does this /page/# actually do? Do I need some standard template or something to make it work?

    This is what I'm trying:

    <?php query_posts('category_name=newsletter&amp;posts_per_page=2'); ?>
    <?php while(have_posts()): the_post(); ?>
    <!-- some stuff with the posts -->
    <? endwhile; ?>
    
    <?php next_posts_link('« Older Entries') ?>
    <?php previous_posts_link('Newer Entries »') ?>
  2. stvwlf
    Member
    Posted 5 years ago #

    Try replacing your query_posts statement with this code

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("category_name=newsletter&amp;posts_per_page=2&amp;paged=$paged");
    ?>

    Use single & and not & a m p ;
    Make sure to have double quotes on the query_posts line.
    Should fix paging.

  3. bsummer
    Member
    Posted 5 years ago #

    Thanks a lot for your response stvwlf, however it didn't work.
    The new code looks like this, with exactly the same results:

    (note even though they show up as & here they're really just &)

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("category_name=newsletter&amp;posts_per_page=2&amp;paged=$paged"); ?>
    <?php while(have_posts()): the_post(); ?>
    
    <!-- some stuff with the posts -->
    
    <? endwhile; ?>
    <?php next_posts_link('« Older Entries') ?>
    <?php previous_posts_link('Newer Entries »') ?>

    Clicking on the Older Entries link does send me to page/2, but it's still just blank.

    Anyone else have an idea?

  4. SanjeeOnP
    Member
    Posted 5 years ago #

    I have the same problem http:// (leblog)&'(.uneviemoinschere')& . com

    I found on the web that we got to :
    "
    It’s a simple fix for a common problem. Within the Settings of your WordPress dashboard, click on the Permalink Redirect tab. Within the Permanent Redirect Manager, include the following line in the “Paths to be skipped” box:

    /page/*
    "
    (Source : http://www.yoursearchadvisor.com/blog/wordpress-next_posts_link-broken)

    But, on my wordpress, there is no Paths to be skipped...

    Can someone help us?

  5. itsbarry
    Member
    Posted 4 years ago #

    I just wanted to confirm that stvwlf's code substitution worked for me on wordpress 2.9.2. My older posts link now works as expected.

    Thanks, stvwlf!

    Barry

Topic Closed

This topic has been closed to new replies.

About this Topic