How to style the latest post differently?
-
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 ifHow 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 ‘-‘.
- The topic ‘How to style the latest post differently?’ is closed to new replies.