Viewing 5 replies - 1 through 5 (of 5 total)
  • Normally your entries are individually wrapped in their own div tags. Most likely the class will be “post” (code located in your main template):

    <div class="post">

    Add a little php code:

    <div class="post<?php if(!is_single() && $post==$posts[0]) echo '-firstpost';?>">

    This code checks two things. 1) The current page must be a listing of entries, not a single entry’s permalink page, and 2) it singles out the first post in the loop array, $posts[0].

    If both conditions are met, “-firstpost” is appended. So your first post’s div will be of the class “post-firstpost” and all other entries simply “post”.

    From here on out, just edit your stylesheet.Create a new entry called “.post-firstpost” and add your style elements to customize.

    Even easier:
    Edit stylesheet. Duplicate the class “.post”, rename the copy to “.post-firstpost”. Now both are identical, a better starting point. Make changes as necessary.

    Hope this helps you out! Make sure to search the forums before asking questions, as this may have been addressed before.

    Thread Starter dante

    (@dante)

    Thanks Mindless. I did do a search before asking, and couldn’t find anything.

    Let us know if this works. If it does I’d love to use it, if it doesn’t there are some other scripts I can steer you toward, but they’re a fair bit more complicated than this.

    This is like a sticky post. And it’s exactly what I’m looking for too. Any ideas about styling, dante or kickass? I don’t want something too garish. Perhaps a light dotted line around the post or a very very light opaque color? I’m off to play with the code.

    You can style it any way you want. Depends upon your style of theme. I recommend that it 1) matches, 2) blends to a point, and 3) is distinctive yet easy to read. This usually equates to italics, background color, or a border of some kind.

    The best looks I’ve seen using this actually separated the most recent post from the rest of the list with space and a design or border between or highlighted the most recent post in a “box” (like dark background with white/light text (reverse of the site’s look) or just a nice contrasted background with a border.).

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Special “latest post” styling’ is closed to new replies.