Support » Fixing WordPress » Paging displays 1 extra page that is empty

  • Resolved gregnak

    (@gregnak)


    Hi everyone!
    I’ve been searching for hours but could find any soloution to my problem.

    I have a template-file that lists all the posts from the category “blogg”
    What i want to do is show the first 10 posts, then use next_posts_link to go to page 2 etc etc.
    Edit:
    And if it’s less then 10 posts, it still displays navigation, and ads 2 extra pages, thats empty.

    It works, exept for one thing. When i’ve clicked through the pages, i get one last page thats empty. Any ideas? Heres the code:

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $get_blog = new WP_Query('category_name=blogg&posts_per_page=10&paged=' . $paged);?>
    <?php while ($get_blog->have_posts()) : $get_blog->the_post();
    if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>

    And the navigation:

    <?php previous_posts_link('&laquo; Nyare') ?>
    <?php next_posts_link(' Äldre &raquo;') ?>

    Thanks in advanced!

Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Paging displays 1 extra page that is empty’ is closed to new replies.