I was having problems with the page navigation(empty pages or staying on the first page w/excluded categories) so i decided to use this wp_query code for my blog loop which is NOT on the homepage:
<?php twentyeleven_content_nav( 'nav-above' ); <?php /* Start the Loop */ ?> <?php //query_posts('paged='.$paged); $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query(); $wp_query->query('showposts=5'.'paged='.$paged); ?> <?php $recentPosts = new WP_Query(); $recentPosts->query('showposts=5'.'&paged='.$paged) ?> <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?> <?php get_template_part( 'content', get_post_format() ); ?> <?php endwhile; ?> <?php $wp_query = null; $wp_query = $temp;?> <?php twentyeleven_content_nav( 'nav-below' ); ?>
Page Navigation is working,
but now I’m having problems excluding a category.
Any code I found with an excluded category messed up the pave nav.
I want to exclude two categories and have a working page navigation, but I continue to go in circles.
- The topic ‘Excluding a Category using wp_query – with working page navigation’ is closed to new replies.