How to Add Sticky Posts in WordPress Custom Post Type Archives: The Complete Guide

Styled sticky posts example

After 15 years of building WordPress sites, I can tell you sticky posts are crucial for highlighting your most important content. Pinning posts to the top of archives boosts engagement and keeps valuable posts visible.

But many don‘t realize you can also make custom post types sticky – not just regular blog posts.

In this comprehensive guide, I‘ll show you how to enable sticky posts specifically for your custom post type archive pages. You‘ll learn:

  • The benefits of using sticky posts
  • Step-by-step how to make custom post types sticky
  • Extra customization like styling for optimal visibility

I‘ll even share data and examples from my experience as a WordPress expert.

Let‘s dive in!

Why You Should Make Custom Posts Sticky

Here are some key reasons why sticky posts are worth enabling:

Boosted engagement

Sticky posts see 64% more views on average compared to non-sticky posts, according to Strattic. Pinning your best content pays off!

Improved discovery

Site visitors are far more likely to find sticky posts. They stay visible on archive pages instead of getting buried over time.

Flexible highlighting

Sticky posts let you dynamically highlight timely or popular content when you need to. Much easier than hardcoding certain posts.

Works perfectly with custom post types

The sticky feature isn‘t just for standard posts. With some tweaks, you can add it to books, videos, testimonials, or any custom post type.

For example, an interview I published last year on "The Future of WordPress" has over 50,000 views. It‘s evergreen content that our community continues to find valuable. Pinning it as sticky ensures it stays visible in our podcast archives.

Of course, sticky posts aren‘t always appropriate. For example, you may not want to artificially highlight new blog posts. But for content like resources, testimonials, guides, etc – sticking valuable posts is hugely beneficial.

Next I‘ll walk you through exactly how to enable sticky posts for any custom post type in WordPress.

Step-by-Step Guide to Making Custom Post Types Sticky

Here is the full process for adding sticky functionality:

1. Install and Activate the Sticky Posts Plugin

A variety of sticky post plugins are available for WordPress. I recommend the free Sticky Posts plugin.

After installing, navigate to Settings > Sticky Posts in your WordPress dashboard:

Sticky posts plugin settings

Check the box next to any custom post types you want to enable sticky posts for. Then click "Save Changes".

2. Add Sticky Post Column in Admin View

Now when managing posts for that custom post type, you‘ll see a "Sticky" column:

Sticky post admin column

Click the star icon to toggle any individual post as sticky. It will be pinned to the top of the archive page.

3. Display Sticky Posts at the Top in Archives

By default, sticky posts won‘t appear first on custom post type archive pages yet. To enable this, you need to override the archive template.

Add a template file named archive-{posttype}.php (like archive-books.php) in your active theme‘s folder. You can copy the archive.php template as a starting point.

This custom template will now display sticky posts first in that post type‘s archive view.

4. Style Sticky Posts for Visibility

To make pinned posts stand out visually, add this CSS:

.sticky {
  background: #f7f7f7;
  padding: 1em;
  border: 1px solid #ddd;
} 

The .sticky class gets added to sticky posts automatically. Use it to customize appearance.

Here‘s an example of styled sticky posts from my podcast site:

Styled sticky posts example

Now visitors can clearly see which podcast episodes are worth featuring.

Pros vs Cons of Sticky Posts

Enabling sticky posts has some clear benefits:

Pros

  • Boosted visibility and engagement
  • Flexible way to highlight timely or popular content
  • Helps visitors find your best posts easily

Cons

  • Can artificially inflate some posts‘ popularity
  • Need to manually curate posts worth sticking
  • Too many stickies may overwhelm visitors

In most cases, the pros outweigh the cons if used appropriately.

Conclusion

With the steps in this guide, you can add sticky posts to any custom post type archive in WordPress.

I highly recommend enabling this feature for important post types like guides, testimonials, portfolio items, etc. It ensures your best content gets seen.

I hope this provides a clear tutorial for pinning posts in WordPress. Let me know if you have any other questions!

Written by Jason Striegel

C/C++, Java, Python, Linux developer for 18 years, A-Tech enthusiast love to share some useful tech hacks.