In my theme I have two separate pages for blogs. The main blog page, "news.php", holds our standard news, thoughts, events type of posts. The second blog, "questions.php", holds blog postings of only the "Ask a Question" category. In my sidebar I've included the default "Recent Posts" widget.
On the main blog page, the query is set up like so to exclude the "Ask a Question" category:
$args = array ( 'posts_per_page' => 7, 'cat' => -16, 'paged' => $paged, ); $wp_query = new WP_Query( $args );
On the Ask a Question blog page, the query is set up like so, to only display the "Ask a Question" category:
$args = array ( 'posts_per_page' => 7, 'cat' => 16, 'paged' => $paged, ); $wp_query = new WP_Query( $args );
Everything seems to work nicely until you get to the "Recent Posts" widget. In the standard news page, the widget displays just fine, showing the proper listing of blog posts. However, on the Ask a Question page, the widget is showing pages, as well as postings, some of which do not exist. For example this is on the list:
- Another test post? I THINK SO!
- TEEEEESSSSSSTTTTT POST!!!
- pump up the jam, pump it up!
If I comment out the category listing from questions.php in the query, everything works fine. So the line that causes a problem is:
'cat' => 16,
I was hoping that someone may be able to help me understand why this is occurring, or possibly how to fix it. Thank you for your time and attention, it is greatly appreciated.