Ultimate Guide to WordPress Sticky Post

Have you ever been in WordPress and wondered how you can force a post to the top of your WordPress post list? Had trouble finding an answer that gave you the entire picture?

What is a WordPress Sticky Post? A WordPress sticky post is a post that the user enables to be pinned to the top of the WordPress posts list. This post will always show up first and at the top of the list allowing you to control what the user sees. Sticky posts also have several options that allow you to change them to your needs.

So if you want to learn how to do sticky posts for your blog or website then look no further. We will dive into all the settings and talk about some cool things you can do to make your sticky posts stand out from the crowd.

When to use a sticky Post

sticky-post

Sticky posts are something that people should be used sparingly but if used correctly they can make yourself easier if you do a lot of blogging. When you consider using them you need to first understand what they are.

Sticky posts are any single post that you want to show up at the top of a query result such as recent posts or even just all posts. This post once we make it to be sticky will show up at the top of the results no matter what.

Certain types of content lends itself well to better sticky post guidelines than others, examples of this would be:

Pillar Content

These are articles that you want a large amount of eye balls or traffic looking at your content. This content is often very interactive with graphics, charts, and big images. Pillar content will often involve content that the website wants to showcase such as affiliate articles, Important subjects for your niche, or just something you deem important.

Critical Content

This content is content that has a defined expiration date such as something that is an announcement or give-away. These types of articles focus on informing the public about something going on behind the scenes. Some people will use this content to generate buzz and get your audience interested in a topic or event.

How to make a WordPress Sticky Post

sticky-post-creation

There are two very simple ways to make a WordPress post sticky. Once you are inside of the WordPress editor open up any post that you want to be sticky and edit that page. Inside of the page settings on the right-hand side of the screen in Gutenberg you will find an area under the document tab which is Status and visibility.

Clicking this will give you the publish area of the post and underneath publish you will find stick to the front page. This will make your post sticky by clicking this checkbox.

If you prefer a quicker method, you can also go to your post screen which will show a list of your posts. The page at the top will have things like All, published, draft and trash. You will also see a drop down which will allow you to perform certain page actions such as deleting a page.

An example of the area to click to sticky

When you hover over a post, you will see a menu show up underneath that post which will say edit, quick edit, trash and view; go ahead and click quick edit.
This will open up another menu which will show you details about the page. Right above the publish button there is the option to make a post sticky. Click that checkbox and save the page and your page should now be sticky.

Congrats you have created a sticky post that will show up on all your content. If you want to learn about some unique things you can do with sticky posts, then continue reading.

How to automatically expire sticky posts

If you are someone who is used to scheduling your posts, then you might have already found our first trick but sticky posts can have an expiration date. This is right under the date that you set for a post to be published and you can use the calendar functions just like you would a normal post.

If you set an expiration date for a sticky post, then after that date the sticky post will return to a normal post status. That post will no longer show up at the top of your list.

Display Latest Sticky Posts

Sometimes show off sticky posts that have been achieved because of time. Using the code below you can edit the functions.php of your WordPress website or even better yet use a child theme. Once you have pasted the following code into the functions, you can use the following short code to have sticky posts show up anywhere on your page.

function wpb_latest_sticky() { 
 
/* Get all sticky posts */
$sticky = get_option( 'sticky_posts' );
 
/* Sort the stickies with the newest ones at the top */
rsort( $sticky );
 
/* Get the 5 newest stickies (change 5 for a different number) */
$sticky = array_slice( $sticky, 0, 5 );
 
/* Query sticky posts */
$the_query = new WP_Query( array( 'post__in' => $sticky, 'ignore_sticky_posts' => 1 ) );
// The Loop
if ( $the_query->have_posts() ) {
    $return .= '<ul>';
    while ( $the_query->have_posts() ) {
        $the_query->the_post();
        $return .= '<li><a href="' .get_permalink(). '" title="'  . get_the_title() . '">' . get_the_title() . '</a><br />' . get_the_excerpt(). '</li>';
         
    }
    $return .= '</ul>';
     
} else {
    // no posts found
}
/* Restore original Post Data */
wp_reset_postdata();
 
return $return; 
 
} 
add_shortcode('latest_stickies', 'wpb_latest_sticky');

Just insert [latest_stickies] anywhere that you want those old sticky posts to show up and you will have a page of sticky posts.

Related Questions

What’s the best use for a sticky post? The best use of a sticky post is to show off a piece of content that you are proud of or that has value to your readers. It could be content which you think your readers need to know about or will enjoy.

Is there a sticky post plugin? There are older plugins which add functionality that you may find in other articles but most of these plugins are outdated and no longer maintained which means they are not safe for your website. 

Conclusion

I hope this post has opened your eyes to the possibility of sticky posts and what you can do with them. If you enjoyed this content and want to learn more about WordPress or page builders, then please visit our website.

Patrick McCoy
Patrick McCoy

Patrick is a web designer with over 20 years experience in websites and design. He spends most of his days writing content and enjoys tinkering with anything web or design related. When he isn't work he is often watching a good movie.

Articles: 86