<?php
/*
Template Name: How Tos
*/
?>
<?php get_header(); ?>
<div class="content">
<?php
/************************* LOOP 1 Features one post in a longer excerpt**********************/
query_posts('category_name=how-to&showposts=1');
while (have_posts()) : the_post();
$do_not_duplicate = $post->ID; // ID post to exclude in second loop
?>
<div class="entry">
<div id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<?php add_filter('excerpt_length', create_function('','return "150";')); ?>
<?php the_excerpt();
//or
// the_content();
?>
<p class="postmetadata"><?php if (is_callable('the_tags')) the_tags('Tags: ', ', ', '<br />'); ?>Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
</div>
</div>
<?php endwhile;
/************************* LOOP 1 Ends **********************/
/************************* LOOP 2 Lists 5 as shorter excerpt**********************/
query_posts('category_name=how-to&showposts=6'); //6 more mosts minus 1 excluded
while (have_posts()) : the_post();
if( $post->ID == $do_not_duplicate ) continue; //exclude the first single ID
update_post_caches($posts);
$do_not_duplicate_2[] = $post->ID; // ID the second set, now an array, of posts to exclude
?>
<div class="entry">
<div id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<?php add_filter('excerpt_length', create_function('','return "55";')); ?>
<?php the_excerpt(); ?>
<p class="postmetadata"><?php if (is_callable('the_tags')) the_tags('Tags: ', ', ', '<br />'); ?>Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
</div>
</div>
<?php endwhile;
/************************* LOOP 2 Ends **********************/
/************************* LOOP 3 Lists 10 in sidebar markup **********************/
?>
<ul>
<?php
query_posts('category_name=how-to&showposts=16'); //16 more posts minus those about to be excluded
while (have_posts()) : the_post();
if( $post->ID == $do_not_duplicate ) continue; //exclude the first single ID again
if( in_array($post->ID, $do_not_duplicate_2) ) continue; //exclude the second IDs in array
update_post_caches($posts);
?>
<li id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a>
</li>
<?php endwhile; ?>
</ul>
<?php
/************************* LOOP 3 Ends **********************/
?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>