• Hi All

    I’m working on a blog that has a featured post on the home page, followed by a grid of other non-featured posts below it.

    The structure is more or less as follows :

    <?php
    // necessary for the tags to show up in a custom loop
    global $wp_query;
    $wp_query->in_the_loop = true; 
    
    // custom loop
    $q_featured = new WP_Query('&category_name=featured&showposts=1');
    while ($q_featured->have_posts()) : $q_featured->the_post();
    $do_not_duplicate = $post->ID;
    ?>

    // featured posts
    <?php endwhile; ?>

    <?php
    query_posts($query_string . '&cat=-9');
    if (have_posts()): while(have_posts()) : the_post();
    if( $post->ID == $do_not_duplicate ) continue;
    ?>

    // non featured posts

    <?php endwhile; endif; ?>

    It’s 99.9% there, except that the next_posts_link function adds an extra page – it shows a third page when there are only two, which causes a 404 error. The first two pages work fine.

    Anyone else had a similar problem?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘next_posts_link 404 error’ is closed to new replies.