How to Display the Latest Sticky Posts in WordPress
If your theme allows it you can create posts and make them sticky which puts them at the top of all your other posts. To make that happen we’ll write some code for our functions.php file. You can also do this for a site specific plugin if you prefer.
As it sounds, this tutorial is an intermediate level tutorial and will require some basic html/css and WordPress themes knowledge. First thing we’ll do is copy and paste this code in our functions.php file. This code gets the latest 5 sticky posts and displays them with the title, the link.
And it also has a shortcode functionality. So you can display this on a post, page or widget on your site.
If you do want to put the sticky in a text widget then add this extra line to the funtions for that.
I’ll add it to a post.
And we’ll take a look at it on our demo site,
to see it in action.
I hope you liked this article and found it helpful.