Title: dmayman's Replies | WordPress.org

---

# dmayman

  [  ](https://wordpress.org/support/users/dmayman/)

 *   [Profile](https://wordpress.org/support/users/dmayman/)
 *   [Topics Started](https://wordpress.org/support/users/dmayman/topics/)
 *   [Replies Created](https://wordpress.org/support/users/dmayman/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/dmayman/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/dmayman/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/dmayman/engagements/)
 *   [Favorites](https://wordpress.org/support/users/dmayman/favorites/)

 Search replies:

## Forum Replies Created

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

 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [Using category templates on category children](https://wordpress.org/support/topic/using-category-templates-on-category-children/)
 *  Thread Starter [dmayman](https://wordpress.org/support/users/dmayman/)
 * (@dmayman)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/using-category-templates-on-category-children/#post-1178580)
 * Any thoughts?
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [query_posts isnt working with next_posts_link](https://wordpress.org/support/topic/query_posts-isnt-working-with-next_posts_link/)
 *  Thread Starter [dmayman](https://wordpress.org/support/users/dmayman/)
 * (@dmayman)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/query_posts-isnt-working-with-next_posts_link/#post-1166016)
 * I think I’ve got it. It’s all working now, so I’ll update if it stops working.
   For those with the same problem, here’s what I did.
 * I’m basically combining the old wp_query’s query with my new additions (only 
   allowing ‘Blog’ categories through). This way, if I click on “August” in the 
   blog section, it’s saying “Here’s every post in August that is ALSO in ‘blog'”
 * My problem earlier was that the $wp_query variable was still intact, so any functions
   that used it (next_posts_link, etc.) were using the OLD query, which included
   more posts than I wanted. So at the end of my code I dump the old wp_query and
   fill it with my new combined query. It’s working so far.
 * Check out the code:
 *     ```
       global $wp_query; //grab the old wp_query
       	$newQuery = array_merge( //merge the old and new into $newQuery array
       		array('category_name' => 'Blog'),
       		$wp_query->query
       		);			
   
       $wp_query= null; //empty the old query
          $wp_query = new WP_Query(); //reinitialize the object
          $wp_query->query($newQuery); //finally, tell WP to make a query with our new variable
       ```
   
 * Hope this helps anybody in the same situation!
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [query_posts isnt working with next_posts_link](https://wordpress.org/support/topic/query_posts-isnt-working-with-next_posts_link/)
 *  Thread Starter [dmayman](https://wordpress.org/support/users/dmayman/)
 * (@dmayman)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/query_posts-isnt-working-with-next_posts_link/#post-1166000)
 * If I don’t merge, the page will ignore the user’s request of how to display the
   content. For example, if the user clicks “August 2009” the page will still display
   all the posts in the ‘Blog’ category, not just ‘Blog’ posts that are also in 
   August. It also starts from the first post in the results on each page, like 
   page 2 would show posts 1 and 2 vs posts 3 and 4, as well as any page beyond 
   that.
 * Here’s the page:
    [http://dg2m.com/wordpress/2009/](http://dg2m.com/wordpress/2009/)
 * It’s still not very operational. The only links that really work are the date
   links and the category links, since I’ve only created my archive.php page so 
   far.
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [query_posts isnt working with next_posts_link](https://wordpress.org/support/topic/query_posts-isnt-working-with-next_posts_link/)
 *  Thread Starter [dmayman](https://wordpress.org/support/users/dmayman/)
 * (@dmayman)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/query_posts-isnt-working-with-next_posts_link/#post-1165990)
 * Anybody have any idea?

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