• asianmack

    (@asianmack)


    I would like to display the first post differently. http://en.blog.wordpress.com/ does this on the homepage. That first post entitled “DNS Editing Deployed by Andy Skelton” is different and has an additional class called “first”.

    How do I do this on my WordPress installation? Thanks for any ideas!

Viewing 2 replies - 1 through 2 (of 2 total)
  • esmi

    (@esmi)

    Something like:

    <?php $c = 0;?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); $c++;?>
    <?php if($c ==1) $class = 'first';
    else $class='';
    ?>
    <div <?php post_class($class) ?> id="post-<?php the_ID(); ?>">

    in your theme’s index.php template file should work.

    Thread Starter asianmack

    (@asianmack)

    Awesome esmi. Thank you that worked!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display first post differently than others on homepage’ is closed to new replies.