WordPress.org

Support

Support » How-To and Troubleshooting » next_posts_link page/2 is blank

next_posts_link page/2 is blank

  • 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 »') ?>

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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.

    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?

    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?

    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

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘next_posts_link page/2 is blank’ is closed to new replies.
Skip to toolbar