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:
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:
border: 1px solid black;
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.
A sticky post looks like this.
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.