Creating a Featured Posts block, as we have seen earlier, allows you to specify some posts to be displayed on your blog as the featured posts. However, you may prefer to automatically make your latest posts stand out. In this recipe, we shall learn to modify the classic WordPress loop to give another style to your latest posts.
Similar to the previous recipe, you only need a text editor, a WordPress theme, and—of course—this book to achieve the hack. This recipe is based on the WordPress default theme, but can be adapted on any other theme as well.
Open the
index.php
file from your theme and look for the WordPress loop. In the WordPress default theme, the WordPress loop is located on line 5 and looks similar to the following code:<?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark"...