dmayman
Forum Replies Created
-
Forum: Themes and Templates
In reply to: Using category templates on category childrenAny thoughts?
Forum: Themes and Templates
In reply to: query_posts isnt working with next_posts_linkI 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
In reply to: query_posts isnt working with next_posts_linkIf 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:
https://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
In reply to: query_posts isnt working with next_posts_linkAnybody have any idea?