Identifying most recent post for alternate styling
-
Hey gang, I need a little PHP guru help!
I’d like to style the most recent post on my homepage differently than the rest. I’ve written a counter script (shown below) but it resets on the rest of the pages so the first post on each subsequent page is also styled as if it were post #1. Here’s my code:
‘
<?php $post_number = 0; ?>
<?php while ( have_posts() ) : the_post() ?>
<?php $post_number++; ?><div <?php if ( $post_number == 1 ) { ?>class=”article_preview_featured”<?php } else { ?>class=”article_preview”<?php } ?>>
>> MY POST CONTENT WOULD BE HERE <<
</div>
<?php comments_template() ?>
<?php endwhile ?>
‘Any help would be GREATLY appreciated!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Identifying most recent post for alternate styling’ is closed to new replies.