In my loop.php (see below) I basically have a condition where if the page is not paginated (i.e. if the URL does not look something like this: example.com/page/2) then display 2 posts with a category of "featured-content"...otherwise if the page is paginated then display 5 posts. This works fine except it is not properly querying the "featured-content" category as posts marked with this category are not always showing up in the loop feed.
I hope I articulated the issue properly, if not please let me know and I'll clarify.
<!-- Featured Content Slider -->
<?php include('includes/featured-content-slider.inc.php'); ?>
<!-- /Featured Content Slider -->
<!-- 960 16 Column Grid -->
<div class="container_16" <?php if (!is_paged()) { echo "id=home";} ?>>
<!-- Featured News -->
<section class="grid_10 featured-news" <?php if (is_paged()) {echo "id=margin-top-120-o";}?>>
<!-- Featured News Heading -->
<h1><span class="biography">Featured Content</span></h1>
<!-- /Featured News Heading -->
<!-- Featured News Loop -->
<?php
if (!is_paged()) {
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args=array(
'post_type'=>'post',
'category_name' => 'featured-content',
'posts_per_page' => 2,
'paged'=>$paged
);
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query($args);
} else {
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args=array(
'post_type'=>'post',
'category_name' => 'featured-content',
'posts_per_page' => 5,
'paged'=>$paged
);
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query($args);
}
if (function_exists('wp_pagenavi')) { wp_pagenavi(); }
if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post();
?>
<!-- /Featured News Loop -->
<!-- Post -->
<article class="post" id="post-<?php the_ID(); ?>" <?php post_class(); ?> >
<!-- Featured News Title -->
<span><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( '%s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
</span>
<!-- /Featured News Title -->
<!-- Featured News Meta -->
<p class="featured-news-post-meta">By <span class="featured-news-author"><?php echo get_the_author(); ?></span> / <?php echo get_the_date('m.d.Y'); ?></p>
<!-- /Featured News Meta -->
<!-- Featured News Thumbnail -->
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(array(640,320)); ?></a>
<!-- /Featured News Thumbnail -->
<!-- Featured News Excerpt -->
<p class="featured-news-excerpt"><?php the_excerpt(); ?></p>
<!-- /Featured News Excerpt -->
<!-- Featured News Social Links -->
<?php include('includes/social.inc.php'); ?>
<!-- /Featured News Social Links -->
</article>
<!-- /Post -->
<!-- Featured News Loop -->
<?php
endwhile; endif;
/* PageNavi at Bottom */
if (function_exists('wp_pagenavi')){wp_pagenavi();}
$wp_query = null;
$wp_query = $temp;
wp_reset_query();
?>
<!-- /Featured News Loop -->
<!-- Pagination -->
<?php if ($wp_query->max_num_pages > 1) : ?>
<div class="grid_10 pagination older-news">
<?php next_posts_link( __( '<span class="arrow">←</span> Older', 'twentyten' ) ); ?>
<div class="pagination newer-news">
<?php previous_posts_link( __( 'Newer <span class="arrow">→</span>', 'twentyten' ) ); ?>
</div>
</div>
<?php endif; ?>
<!-- /Pagination -->
</section>
<!-- /Featured News -->
<!-- What's Happening -->
<div <?php if (is_paged()) {echo "id=margin-top-120-o";}?>>
<?php include('includes/whats-happening.inc.php'); ?>
</div>
<!-- /What's Happening -->
</div>
<!-- /960 16 Column Grid -->