Posted on 29 January, 2009 By Kim Woodbridge 22 Comments

How to Style a Sticky Post in WordPress 2.7

pasta

On Monday I finally found the sticky setting and on Wednesday I showed you how to add the post class to your template so that your sticky post would actually show up on the page.

Today I am going to show you how to style the sticky post. You might want it to look different from the rest of the posts, stand out in some way or not include the date.

Since we have already added the post class to our template, styling the sticky post only requires a little bit of CSS in the style sheet template.

Post class adds the class sticky. So to style the sticky post, add the following to your style sheet:

.sticky {

}

Of course, we need to add some more CSS to that for anything to look different with the sticky post.

On my elephant website, I have the following code:

.sticky {
background:#fff8dc;
border: 1px solid black;
margin-bottom: 7px;
}

This gives the sticky post a yellow background, a thin black border, and a margin at the bottom so the posts don’t bunch together. A regular post looks like this.

eleblog_post

A sticky post looks like this.

eleblog_sticky

If you are very observant, you will see that the sticky post does not have the date in it. This is done with conditional code within the loop. I know you’re excited, but that will have to be the topic of another article.


Related Posts:
  • How to Make a Post Sticky in WordPress 2.7
  • How to Style the Read More Link in WordPress
  • Adding WordPress 2.7 Threaded Comments to your Theme
  • (Anti) Social-Lists 5/24/09
  • Using Thumbnails for Excerpts Plugin with Query Posts to Make a Custom Sidebar Block in WordPress
  • Posted In : WordPress Tips
    If you enjoyed this post, please subscribe to my RSS Feed

    Post to Twitter   Post to Delicious   Post to StumbleUpon

    22 Responses to “How to Style a Sticky Post in WordPress 2.7”

    Leave a Comment
    You may use: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> .


    Recent Comments

      • Kim Woodbridge: HI Dennis - That's exactly right - it's like a macro for WordPress. Don't the Office programs still use them?...
      • Dennis Edell: Anyone needing to ask what a macro is, please do it privately...I hate looking so old in public. LOL! .-= Dennis Edell´s...
      • Kim Woodbridge: Hi Juncai - There isn't any mention of the alt tag in the fbml documentation for the share tag. I tested it by adding i...
      • Dennis Edell: The commonly used link is awesome. Kinda like a modern day macro, yes? .-= Dennis Edell´s last blog .....
      • Kim Woodbridge: Hi Shirley - I would be happy to answer your questions but I don't understand them. Are you referring to the Facebook s...
      • Kim Woodbridge: Hi Dennis - I could never park a car like that - even lining it up with the door in order to get into the house :-)...
      • Kim Woodbridge: Hi Carla - I didn't mean to sound snippy - I am a little irresponsible about it. I could get ok insurance if I tried h...
      • Kim Woodbridge: Hi Jamie - Thank you so much! And I'm really glad this helped you get the video on your fan page :-)...