I am using the Starker Theme as a foundation to build my custom WordPress theme. The Starker Theme comes with a loop.php file for setting up the main loop. I decided to use the loop.php file to display content on the homepage of my site. I would like to incorporate this loop as well as the pagination on other pages of my site but I would only like to query specific categories. Below is the code I have in my loop.php. What's the best way to setup other pages or templates on my site and have their own unique queries without conflicting with the main loop?
<!-- 960 16 Column Grid -->
<div class="container_16">
<!-- Featured News -->
<section class="grid_10 featured-news">
<!-- Featured News Heading -->
<h1></h1>
<!-- /Featured News Heading -->
<!-- Featured News Loop -->
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args=array(
'post_type'=>'post',
'cat' => 'featured-news',
'posts_per_page' => 2,
'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.php'); ?>
<!-- /Featured News Social Links -->
</article>
<!-- /Post -->
<?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 News', 'twentyten' ) ); ?>
<div class="pagination newer-news">
<?php previous_posts_link( __( 'Newer News <span class="arrow">→</span>', 'twentyten' ) ); ?>
</div>
</div>
<?php endif; ?>
<!-- /Pagination -->
</section>
<!-- /Featured News -->
<!-- Other News -->
<aside class="grid_5 other-news">
<!-- Other News Heading -->
<h3></h3>
<!-- /Other News Heading -->
<!-- Other News Loop -->
<?php query_posts('category_name=other-news&showposts=6'); ?>
<?php while (have_posts()) : the_post(); ?>
<!-- Other News List -->
<ul>
<li><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( '%s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
</li>
<li class="other-news-post-date"><?php echo get_the_date('d.m.Y'); ?>
</li>
</ul>
<!-- /Other News List -->
<?php endwhile; ?>
<!-- /Other News Loop -->
<!-- View More -->
<div class="view-more">
<a href="/other-news">View More <span class="arrow">→</span></a>
<div>
<!-- /View More -->
</aside>
<!-- /Other News -->
</div>
<!-- /960 16 Column Grid -->