• 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

Viewing 1 replies (of 1 total)
  • 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.

Viewing 1 replies (of 1 total)
  • The topic ‘Styling the First / Latest post…?’ is closed to new replies.