neoian2
Member
Posted 4 years ago #
I would like to make the latest post on my website be in a differently styled box and show as an excerpt. I would like the remaining posts on the front page to be shown in full and all styled differently than the first post but all the same.
How do I accomplish this?
In The Loop you can test for the first (latest) post by comparing the current $post object in The Loop with the first post from the $posts object, and then modify how you display your posts based on this:
<?php if( is_home() && ($post == $posts[0]) ) : ?>
<div class="firstpost">
<?php the_excerpt(); ?>
</div>
<?php else : ?>
<div class="post">
<?php the_content(); ?>
</div>
<?php endif; ?>
Also note this is an oft-asked question:
http://wordpress.org/search/different+first+post?forums=1
http://wordpress.org/search/different+latest+post?forums=1