WordPress next_posts_link() only reloads the same page

I’m having a problem with my WordPress theme. My next_posts_link() only reloads the same page. Here’s my code.

    <div id="main">

    <?php query_posts('category_name='.get_the_title().'&post_status=publish,future');?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <div class="utdrag">
    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>

    <div class="crop"><a href="<?php the_permalink(); ?>">
    <?php 
    if ( get_the_post_thumbnail($post_id) != '' ) {

    echo '<a href="'; the_permalink(); echo '" class="thumbnail-wrapper">';
    the_post_thumbnail();
    echo '</a>';

    } else {


    echo '<img src="';
     echo catch_that_image();
    echo '" alt="Image unavailable" class="crop" />';
     echo '</a>';

    }

    ?></a>
    </div>
    <?php the_excerpt(); ?>
</div>
    <?php endwhile; else: endif; ?>

    <?php next_posts_link();?><?php previous_posts_link();?>


</div>

I’m using a static page as my front page. As you can see it’s only displaying posts that have the same category as the page title: query_posts('category_name='.get_the_title().'&post_status=publish,future');

Read More

This is something I want to keep. So does anyone know why it just reloads? Why it isn’t changing to the next page?

Related posts

Leave a Reply

2 comments

  1. I figured it out! I’m posting it here in case someone else is having the same problem!

    I added this code at the top:

    <?php if ( get_query_var('paged') ) {
         $paged = get_query_var('paged'); 
         }
        elseif ( get_query_var('page') ) { 
        $paged = get_query_var('page'); 
        }
        else { $paged = 1; }
    ?>
    

    And replaced this:

    <?php query_posts('category_name='.get_the_title().'&post_status=publish,future');?>
    

    with this:

    <?php query_posts('catery_name='.get_the_title().'&showposts=2'.'&paged='.$paged); ?>
    

    For more information, check out this link:
    http://wordpress.org/support/topic/front-page-wp-query-pagination-issue-repeating-posts-next_posts_link-help