Posted on 29 January, 2009 By 28 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:

Posted In : WordPress Tips

Did you enjoy this article? I can assist you with your WordPress or Facebook project. Contact me and I will provide you with an estimate. You can also connect with me on Facebook or follow me on Twitter.




web hosting by media temple

28 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 badge

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.

Recent Comments

    • Marbella: Hi Kim, To get a Valentine card from a child who has been working with it for a few days means so much. They show their...
    • Gaynell M. Jones: Hi Kim, Wow, This is amazing! How can you read this much and blog at the same time?.. Well I'm not that a reader myse...
    • Gaynell M. Jones: Wow! This are cute! I will creat this for my darling. Thanks for the sharing this wonderful Idea....
    • Cmack: I found this website that shows how to have thumbnails link to another page by using the alt/title info in the gallery. ...
    • Lily Rose: This is so cute! I love it when people make their day and do the same for their close ones...

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