• I am trying to put a “latest” gif at the bottom of the latest post only. This is the css i am using:
    .firstpost {
    padding: 10px;
    background-image: url(‘image.gif’);
    background-repeat: no-repeat;
    background-position: right bottom
    Here is the php code i am using in index.php:
    \<p><div class=”entry firstpost”></div></p>\
    If you visit here you will see that the image appears in all posts. Where do i put the code so it appears in only the latest post?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Rather than this:

    <p><div class="entry firstpost"></div></p>

    Try this:

    <p><div class="entry <?php if (!$notFirstPost){echo  'firstpost';} ?>"></div></p>
    <?php $notFirstPost = true; ?>

    That will ensure that only the first post gets that “firstpost” class applied to it, not all the posts.

    That’s a nice little code snippet, Adam!
    I should bookmark this 🙂

    Thread Starter carnold

    (@carnold)

    I agree moshu and it worked like a charm! Thanks adambrown.

    Thread Starter carnold

    (@carnold)

    I now have a first post that is not the latest. The first post is “sticky”. So i think i need to make it the latest post and not the first post. You can see it here. How do i check for the latest and not the first post?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Gif in the latest post’ is closed to new replies.