
Like I promised in a previous post, here is the code required to show latest 5 posts followed by 15 more, like on my homepage. You need to edit the index.php template and add 2 sub-loops separated by wp_reset_query(). Simple as that. Here is the entire index.php code (you should be able to pull the entire loop from there):
<?php get_header();?>
<div id="content">
<br clear="all" /><br />
<?php if(have_posts()) : ?>
<?php
query_posts('posts_per_page=5&offset=0');
while(have_posts()) : the_post();
?>
<div id="post-<?php the_ID();?>" <?php post_class();?>>
<h2><a href="<?php the_permalink();?>" rel="bookmark" title="Permanent link to <?php the_title();?>"><?php the_title();?></a></h2>
<small><?php the_time('j F Y');?> by <?php the_author();?></small>
<div>
<div style="float:left; margin-right:8px"><?php echo get_the_image_link(array('Thumbnail','My Thumbnail'),'thumbnail');?></div>
<?php the_excerpt('Read more »');?>
</div>
<div style="clear:both"></div>
<p>Category: <?php the_category(', ');?> | <?php comments_popup_link('No comments »', '1 comment »', '% comments »');?><br /><?php the_tags(); ?></p>
</div>
<?php endwhile;?>
<?php wp_reset_query();?>
<h2>More recent articles</h2>
<br /><br />
<?php
query_posts('posts_per_page=15&offset=6');
while (have_posts()) : the_post();
?>
<div id="post-<?php the_ID();?>" <?php post_class();?>>
<p>
<strong><a href="<?php the_permalink();?>" rel="bookmark" title="Permanent link to <?php the_title();?>"><?php the_title();?></a></strong><br />
<small><?php the_time('j F Y');?> by <?php the_author();?></small>
</p>
</div>
<?php endwhile;?>
<div>
<div><?php next_posts_link(__('« Older Entries','whiskey'));?></div>
<div><?php previous_posts_link(__('Newer Entries »','youdrunk'));?></div>
</div>
<?php else : ?>
<h2>Not found</h2>
<p>No results found.</p>
<?php endif;?>
</div>
<?php get_sidebar();?>
<?php get_footer();?>
You may have noticed that I’m using an unsanitized function, get_the_image_link, to show a thumbnail next to each excerpt. I noticed it when copying the code. Still waiting for a new version of Whiskey Air?



Loading ...