Title: Making Next Page Work
Last modified: August 20, 2016

---

# Making Next Page Work

 *  [Inspireddrum](https://wordpress.org/support/users/inspireddrum/)
 * (@inspireddrum)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/making-next-page-work/)
 * I have a static home page and a different posts page.
 * I want to make my posts page the home page. When I do that everything works fine
   except for the “next page” function.
 * When you click next page it takes you to “www.mydomain.com/page/2” but still 
   shows the posts from page 1.
 * It works fine when the url is “www.mydomain.com/blog/page/2”
 * How can I redirect the next page function to include “blog” in the url so that
   it functions correctly as the home page or make it so that it doesn’t need “blog”
   in the url and functions normally with just “page/2” etc.
 * Thanks in advance for the help!

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [wprock](https://wordpress.org/support/users/wprock/)
 * (@wprock)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/making-next-page-work/#post-3316054)
 * are you using custom query function like query_posts or WP_Query()? After the
   while loop put this function **wp_reset_query()**
 *  Thread Starter [Inspireddrum](https://wordpress.org/support/users/inspireddrum/)
 * (@inspireddrum)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/making-next-page-work/#post-3316057)
 * Here’s what the posts page looks like. I see the WP_Query function but don’t 
   know where to put the reset. There’s also a WP_pagenavi query at the bottom but
   I don’t think that’s affecting it.
 *     ```
       <div id="blog_content">
               <?
                   $args = array(
                       'post_type' => 'post',
                       'posts_per_page' => 5,
                       'paged' =>  $paged
                   );
                   $the_query = new WP_Query( $args );
                   while ( $the_query->have_posts() ) : $the_query->the_post();
               ?>
                   <div class="blog_post">
                       <? if ( has_post_thumbnail() ) : ?>
                           <a href="<? the_permalink(); ?>">
                               <?
                                   the_post_thumbnail('sm_thumb',
                                       array(
                                           'class' => 'excerpt_thumb'
                                       )
                                   );
                               ?>
                           </a>
                       <? else: ?>
                           <a href="<? the_permalink(); ?>"><img class="excerpt_thumb" src="<? bloginfo('template_url'); ?>/img/default_post_thumb.jpg"></a>
                       <? endif; ?>
                       <div class="post_block">
                           <h1 class="font"><a href="<? the_permalink(); ?>"><? the_title(); ?></a></h1>
                           <div class="meta">by <? echo get_the_author(); ?> on <? echo get_the_date(); ?> in <ul class="excerpt_cats"><? echo get_the_category_list(); ?></ul></div>
                           <? the_excerpt(); ?>
                       </div>
                   </div>
               <?
                   endwhile;
                   wp_pagenavi(array(
                       'query' => $the_query
                   ));
                   wp_reset_postdata();
               ?>
           </div>
       ```
   
 *  [wprock](https://wordpress.org/support/users/wprock/)
 * (@wprock)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/making-next-page-work/#post-3316059)
 * <?
    endwhile; wp_pagenavi(array( ‘query’ => $the_query )); wp_reset_postdata();?
   >
 * will be
 * <?
    endwhile; wp_reset_query(); wp_pagenavi();
 *  ?>
 * Try once this
 *  Thread Starter [Inspireddrum](https://wordpress.org/support/users/inspireddrum/)
 * (@inspireddrum)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/making-next-page-work/#post-3316064)
 * That just removed the page navigation at the bottom of the page.
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/making-next-page-work/#post-3316066)
 * try to replace:
 *     ```
       'paged' =>  $paged
       ```
   
 * with:
 *     ```
       'paged' =>  get_query_var('paged')
       ```
   
 *  Thread Starter [Inspireddrum](https://wordpress.org/support/users/inspireddrum/)
 * (@inspireddrum)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/making-next-page-work/#post-3316070)
 * Just tried what you suggested alchymyth and the same thing is still happening.
   Any other ideas?
 *  [wprock](https://wordpress.org/support/users/wprock/)
 * (@wprock)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/making-next-page-work/#post-3316072)
 *     ```
       <div id="blog_content">
               <?// Fix for the WordPress 3.0 "paged" bug.
       $paged = 1;
       if ( get_query_var( 'paged' ) ) { $paged = get_query_var( 'paged' ); }
       if ( get_query_var( 'page' ) ) { $paged = get_query_var( 'page' ); }
       $paged = intval( $paged );
        $args = array(
                       'post_type' => 'post',
                       'posts_per_page' => 5,
                       'paged' =>  $paged
                   );
                   $the_query = new WP_Query( $args );
                   while ( $the_query->have_posts() ) : $the_query->the_post();
               ?>
                   <div class="blog_post">
                       <? if ( has_post_thumbnail() ) : ?>
                           <a href="<? the_permalink(); ?>">
                               <?
                                   the_post_thumbnail('sm_thumb',
                                       array(
                                           'class' => 'excerpt_thumb'
                                       )
                                   );
                               ?>
                           </a>
                       <? else: ?>
                           <a href="<? the_permalink(); ?>"><img class="excerpt_thumb" src="<? bloginfo('template_url'); ?>/img/default_post_thumb.jpg"></a>
                       <? endif; ?>
                       <div class="post_block">
                           <h1 class="font"><a href="<? the_permalink(); ?>"><? the_title(); ?></a></h1>
                           <div class="meta">by <? echo get_the_author(); ?> on <? echo get_the_date(); ?> in <ul class="excerpt_cats"><? echo get_the_category_list(); ?></ul></div>
                           <? the_excerpt(); ?>
                       </div>
                   </div>
               <?
                   endwhile;
                   wp_pagenavi();
                   wp_reset_query();
               ?>
           </div>
       ```
   
 *  Thread Starter [Inspireddrum](https://wordpress.org/support/users/inspireddrum/)
 * (@inspireddrum)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/making-next-page-work/#post-3316076)
 * THANKS WPROCK! That worked! 🙂
 *  [wprock](https://wordpress.org/support/users/wprock/)
 * (@wprock)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/making-next-page-work/#post-3316077)
 * welcome

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Making Next Page Work’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 9 replies
 * 3 participants
 * Last reply from: [wprock](https://wordpress.org/support/users/wprock/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/making-next-page-work/#post-3316077)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
