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

      • Mrs Moody@video tutorial blog: Hi Kim, first time for me in your blog, thanks for this post, lol it's funny and will definitely try it in facebook, gre...
      • JesC: OMG... thank you, Thank You, THANK YOU!!!! I've been beating my head on the desk all night trying to figure out how to g...
      • bhagu: Thanks for sharing... short and simple, but very good information....
      • Kim Woodbridge: Hi Dennis - I even have 2 domain names ... ;-)...
      • Kim Woodbridge: Hi Bobbi - We were discussing that issue on my Facebook page yesterday and no one knows a way to do it - I don't think i...
      • Dennis Edell: Seriously, if not a whole 'nother blog, then at least a page with just links to facebook resources. ;) .-= Dennis Edell´...
      • Bobbi: Thanks for the info on facebook pages... I was wondering if there is any way to check what other pages have added my ...
      • Kim Woodbridge: Hi Vince - LOL - nope....