What is a Sticky post?
Sticky posts are useful when any blogger wants that post to be shown on the front page or home page of his/her blog. Whenever you declare the post as ‘sticky’ from that moment the particular post will appear on the home page of your blog forever. 😉
How to add a sticky post?
- Write on the post editor
- Go to the publish box on the right hand side
- Under the visibility section-> Click on the Stick check box
- Publish the post (see image below)
This post will always appear on the home page. If you want the post to show according to date of other published posts then you need to add the code below in your “index.php” or “home.php” (in the php file of theme which shows blog home page).
$sticky = get_option(‘sticky_posts’); $args=array( ‘caller_get_posts’=>1, ‘showposts’=>4, );// change showposts count as you want query_posts($args);
It must be added before the WordPress loop. By the above code you can get all the latest published or published/sticky post by the default way as WordPress shows.
Hope this post helped you in solving the sticky post problem. If you have any other way of doing so please share it through your comments.