toffee240
Member
Posted 1 year ago #
Hi
I'm a novice to WP, but all installed, working well and tweaking more and more.
I have a design that needs the latest blog post to look different to rest on the page (only needs to be on the index page). In effect all I think I need is to add a CSS class/id to the first post and I can take it from there with some CSS styling..
I have noticed this seems to be a fairly common style but I can't seem to track down how to implement this in the version 3.0 of WP.
Any help would be very much appreciated.
Thanks in advance
I would expect there to be a theme component to any recommendation on how to add this idea to your site.
Depending on the theme, you can add a counter inside the loop then add a conditional if ... else that adds a wrapper to the post display function being used, such as:
$count = 0; /* before the_Loop starts */
...
$count++ /* inside the_loop */
...
<?php if ( ( $count <= 1 ) && ( $paged < 2 ) ) : ?>
<div class="first-post">
<?php the_content(); ?>
</div>
<?php else : ?>
<?php the_content(); ?>
<?php endif; ?>
Not tested (obviously) ... just a starting point for possible edits.