Posted on 29 January, 2009 By Kim Woodbridge 24 Comments

How to Style a Sticky Post in WordPress 2.7

 
Share

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. You can also connect with my Facebook page or follow me on Twitter.



    24 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> .

    CommentLuv Enabled

    Recent Comments

      • Ari Herzog: Agreed on the updates/inbox snafu. I rarely see page updates and I know where they are! .-= Ari Herzog´s last blog .....
      • jayson: Kim, Love the themes. I am looking to update the theme on my site to something more appropriate. My site is all abou...
      • vered: "I wish more people would use this. I think it’s silly when I get updates for things occuring in Kansas and California –...
      • Dennis Edell @ Direct Sales Marketing: I was speaking generally, not specifically this month. how exactly do you work things? .-= Dennis Edell @ Direct Sales M...
      • Lucy Beer: Unfortunately I think next to no-one actually sees those "Updates". They're buried in a subsection of the inbox and I do...
      • Kim Woodbridge: Hi Marbella - Thanks! I had a great time....
      • Kim Woodbridge: Hi Julie - I'll probably try kayaking again next summer but I don't know if I will become much of a kayaker - I had a di...
      • Kim Woodbridge: Hi Vered - If you ever get the chance, you should go. It's like a different world - it's so quiet and peaceful....

    About

    Kim Woodbridge is an accomplished Information and Technical Consultant specializing in the entire implementation of a WordPress based website including installation, theme design, upgrades, unique customizations and ongoing site maintenance.

    Wordpress Services

    • Installation, upgrades and maintenance
    • Conversion of existing html and css templates
    • Theme and plugin recommendations
    • CSS customizations
    • Troubleshooting and tweaks for unique situations
    • Customization for individual blogging goals and needs
    • Training and advice