• I have been working with the templates of my blog and I was trying to work with ‘the Loop’, to get what I want.

    I want to apply a different style (CSS) to the latest post on the front page alone.

    In terms of pseudo code, this is what I figured out:

    if ( have posts )
    while ( have posts )
    --the_post()
    --if (latest post) /* Is it the latest published post? */
    ----<div class="latest-post">
    ----the_title()
    ----the_content()
    ----</div>
    --else /* for all the other posts */
    ----<div class="not-latest-post">
    ----the_title()
    ----the_content()
    ----</div>
    --end if
    end while
    end if

    How do I check if the post fetched by the_posts() is the latest published one (not future published)?

    Thanks in advance. ??
    Please let me know if you require further clarifications regarding this issue.

    Edit: The indentation was lost. I replaced all white space with a ‘-‘.

Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to style the latest post differently?’ is closed to new replies.