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):
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | <?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?