• Why previous_posts_link(); and next_posts_link(); doesn’t work with the following code?

    $args=array(
      'post_type' => 'post',
      'post_status' => 'publish',
      'posts_per_page' => 10,
      'caller_get_posts'=> 1
    );
    $my_query = null;
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
      while ($my_query->have_posts()) : $my_query->the_post(); ?>
    
    <?php the_title(); ?>
    <?php the_content();?>
    <?php endwhile; ?>
    
    <?php if(function_exists('wp_pagenavi')){ wp_pagenavi(); } else { ?>
    <?php previous_posts_link(); next_posts_link(); } ?>
    <?php wp_reset_query(); ?>

    Secondly I put the following code in page.php and it works but when I click “NEXT POSTS LINK” (which appears with this loop) I’m redirected to blank page with only one link that is pointing to the page I just entered.

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('cat='.$category.'' . $query_string . '&showposts=9&paged=' . $paged);
    ?>
    <?php if (have_posts()) : while(have_posts()) : the_post(); ?>
    <?php the_title(); ?>
    <?php the_excerpt(); ?>
    <?php previous_posts_link(); next_posts_link(); } ?>

The topic ‘previous/next_posts_link(); doesn’t work with new query’ is closed to new replies.