WordPress Sticky Posts: How to Use & Style Them

In this blog, I’ll explain you how to use WordPress Sticky Posts and how to style them for better engagement.
The Sticky Post feature in WordPress makes certain posts standout from the ‘pile’ of posts on your blog. By default, WordPress displays the most recent posts at the top, so the sticky post feature is particularly useful when there’s a particular piece of content that you don’t want to get enshrouded by newer posts.
WordPress Sticky Posts
Using this feature is a straightforward process:
Inside your dashboard, go to the edit window of the post you want to highlight. The Sticky option appears when you’re editing or creating a new post. The option is located on the right side of the editor page under Publish settings.
Click the Edit link right beside the Visibility: Public settings. You’ll now see this option: Stick this post to the front page; simply check the box beside it and you’re done.
When you click Update or Publish, your post will stick to the top.
Note that the Public visibility option has to be enabled for sticky posts to work. Password-protected or private posts cannot be made sticky. Also, Sticky post doesn’t work for custom post types.
How To Sort WordPress Sticky Posts
When you have multiple sticky posts on your WordPress blog, you’ll want establish some order in which they are displayed. By default, sticky posts are arranged in descending order based on the time you published them. That is, the most recently posted piece goes to the top of the pile while the first post you made sticky remains at the bottom. This works for some people but, understandably, it may not be what you want.
So here is one way to arrange your sticky posts using the published date stamp.
- Login to your dashboard.
- Select All Posts under Posts and choose the post you want to appear on top of the sticky posts. Hover above the post title and click the Edit link that appears beneath the post title.
- In the Publish settings box on the right, you should be able to see the time stamp for the post. Click the Edit link next to the time stamp.
- Change the publish time of the post you want to appear on top to the current time. Manipulate the order using publish date. Basically, if you want a post to appear higher in the pecking order, make its published date more current than subsequent posts.
If you’re well versed in PHP, you can ‘hack’ the loop and write a function that displays the latest sticky posts on top.
Using A Plugin
The timestamp method for arranging sticky posts isn’t reliable for everyone. In some cases it works in descending order whereas for some, it works in ascending order.
If you’re not getting the order you want using published date, you might want to use the Q2W3 Post Order plugin. This is a newly revamped plugin that not only lets you sort sticky posts on your blog but also lets you organize normal posts on your home page in the order you want. It also lets you order posts within categories and this doesn’t affect the order on the home page. Also, as with categories, you can order posts on the tag page and this will not affect how they are sorted on the home page.
Styling WordPress Sticky Posts
The best way to style your sticky posts is through your child theme’s stylesheet. You’ll mostly be applying your styles to the .sticky class. You can change color of text, titles, or even background. For instance you can target sticky post titles using this selector:
.sticky .entry-title a {
color: yellow;
}
You can also add a background image to your sticky posts if you so wish. Note that using the .sticky class to style your sticky posts only affects those on your home page.
If you want more sophisticated styling for your sticky posts, you can use the post_class() function to generate appropriate classes for styling the different elements within the sticky post. You can read more about this function on its codex page.
Conclusion
The Sticky Post feature is a handy little feature when you want to emphasize certain posts. You can even style and customize your sticky posts to make them really stand out. Ordering sticky posts isn’t straightforward but using the Q2W3 Post Order plugin, you can easily customize your sticky post sorting.
Do you have sticky posts on your blog? How do you go about sorting and styling them?
Leave a Reply