Display the Latest Sticky Posts in WordPress

How to make Sticky Posts in WordPress

In our previous tutorial for How to create a new post to your WordPress Website, I have mentioned about Sticky Post in the Publish area of the Edit Post screen. Sticky posts are placed at the top of all blog posts and stay there until new posts are published.

sticky-posts-option

You can see that making Sticky Posts in WordPress is really easy. Look at the Visibility: Public field on the right side and click Edit. Check the box next to the Stick this post to the front page and publish it.
If you want to make an older post sticky, Open the post to edit and just follow the same steps as above and click save.

How to display the latest Sticky Posts.

Have you ever want to display the latest sticky posts as featured posts for your in WordPress? Following our steps in this section.
First of all, you need to copy and paste code snippet as below into your theme’s functions.php file to queries the WordPress database to retrieve the 5 latest sticky posts (each sticky post’s title with a link in a list format)

The shortcode [latest_stickies] display your latest sticky posts, in any WordPress post, page, or even a text widget.
If you would like to use shortcodes inside a text widget, then you will need to add this extra line of code in your theme’s functions.php file.

Well, I very hope this article is useful enough to help you make Sticky Post and display latest sticky posts on your WordPress Website. See you again in other instructions !

Leave a Reply

Your email address will not be published. Required fields are marked *