How to Make a Sticky Sidebar in WordPress (With or Without a Plugin)

We can display a related posts section, newsletter form, advertisements, and other important content in the website sidebar. The problem is that a normal WordPress sidebar scrolls out of view as visitors move down the page.

A sticky sidebar solves this problem by keeping selected sidebar content visible while the visitor scrolls through the page. I have used this feature on my blogs and tested different approaches for the content I want to keep visible. 

In my experience, a simple CSS solution is usually enough when I only need a basic sticky sidebar. For more advanced requirements, such as making individual widgets sticky or controlling different elements on different devices, a dedicated plugin can be more convenient.

WordPress-sticky-sidebar

In this guide, I’ll show you how to make a sticky sidebar in WordPress without a plugin, how to create one in GeneratePress, how to make only one widget sticky, how to use WordPress blocks, and how to troubleshoot a sticky sidebar that isn’t working properly.

What Is a Sticky Sidebar in WordPress?

A sticky sidebar is a sidebar that remains visible as the visitor scrolls through the main content.

Unlike a normal sidebar, which moves upward and eventually disappears from the screen, a sticky sidebar uses CSS positioning to remain within its available container.

The most important CSS property is: position: sticky;

A top value is also normally required:

position: sticky;
top: 20px;

The top value tells the browser where the element should stop while scrolling.

Sticky vs Fixed Sidebar

These two terms are often used interchangeably, but sticky and fixed positioning are not exactly the same.

Sticky SidebarFixed Sidebar
Uses position: stickyUses position: fixed
Starts in its normal document positionRemoved from normal document flow
Becomes sticky after reaching the specified offsetRemains fixed relative to the viewport
Constrained by its containing blockGenerally positioned relative to the viewport
Usually easier to use for sidebarsCan require additional layout adjustments

For most WordPress content websites, I prefer position: sticky because it works naturally with the existing page layout.

How to Make a WordPress Sticky Sidebar Without a Plugin?

You don’t necessarily need a WordPress plugin to create a sticky sidebar. Modern browsers support CSS position: sticky, so a small amount of CSS is often enough.

Here’s a basic example:

@media (min-width: 769px) {
    .your-sidebar {
        position: sticky;
        top: 20px;
    }
}

Replace .your-sidebar with the CSS class used by your website’s sidebar.

Why use a media query?

I recommend applying the sticky effect only to desktop and larger screens in most cases.

The sidebar layout on a mobile phone is very different from a desktop layout. A sticky sidebar can consume a large portion of the mobile viewport and make scrolling uncomfortable.

That’s why I normally use: @media (min-width: 769px) {

This means the sticky effect will apply only when the screen is at least 769px wide.

How to Find Your WordPress Sidebar CSS Class?

The CSS selector will vary depending on your WordPress theme.

If you’re not sure which selector to use, you can find it using your browser’s developer tools.

Step 1: Open your website, visit the page containing your sidebar.

Step 2: Right-click the sidebar; choose Inspect or Inspect Element.

Step 3: Look at the HTML. Find the container surrounding your sidebar.

You may see something similar to:

<aside class=”widget-area”> or <aside id=”right-sidebar”> or another theme-specific class.

Step 4: Use that selector in your CSS

The exact selector depends on your theme and website structure, so don’t assume that the same selector works on every WordPress website.

How to Make a Sticky Sidebar in GeneratePress?

GeneratePress is one of the WordPress themes where creating a sticky sidebar with CSS is relatively straightforward. I’ve worked with this on WordPress websites and I prefer using CSS rather than adding another plugin.

If you’re using the classic GeneratePress theme with a right sidebar, add the following CSS through

Appearance β†’ Customize β†’ Additional CSS

@media (min-width: 769px) {
    .inside-right-sidebar {
        position: sticky;
        top: 20px;
    }
}

Adjust the top spacing – If your website has a sticky header, 20px may not be enough.

For example:

@media (min-width: 769px) {
    .inside-right-sidebar {
        position: sticky;
        top: 80px;
    }
}

The correct value depends on your header height. I recommend testing the page after adding the CSS instead of blindly copying a particular top value.

How to Make Only One Sidebar Widget Sticky?

You don’t always need to make the entire sidebar sticky. In fact, there are situations where I prefer making only one element sticky.

For example, suppose your sidebar contains:

  1. Search widget
  2. Categories
  3. Recent posts
  4. Newsletter form
  5. Affiliate CTA

You may want only the newsletter form or CTA to remain visible.

Depending on your GeneratePress layout, you can target the last sidebar element with CSS such as:

@media (min-width: 769px) {
    .inside-right-sidebar > *:last-child {
        position: sticky;
        top: 80px;
    }
}

This approach is useful when you want to keep a particular CTA visible without making the entire sidebar sticky.

However, the exact selector depends on how your widgets are structured. Always inspect the HTML if the CSS doesn’t behave as expected.

How to Make a WordPress Widget Sticky?

You can also target an individual widget instead of the entire sidebar.

For example, if your widget has a unique CSS class:

@media (min-width: 769px) {
    .my-sticky-widget {
        position: sticky;
        top: 80px;
    }
}

This gives you more control over your WordPress sidebar.

How to Make a Sticky Sidebar With WordPress Blocks?

If you’re using a modern block theme, the process can be different from the traditional WordPress Widgets interface. Block themes use the Site Editor, and the available options depend on your theme and WordPress version.

In supported block editing environments, you can use the block’s position settings to create sticky elements. A typical workflow is:

  1. Open the Site Editor or relevant template.
  2. Select the sidebar or the Group containing your sidebar content.
  3. Make sure the content you want to keep together is inside the appropriate container.
  4. Look for the Position settings in the block options.
  5. Choose Sticky, when available.
  6. Configure the top offset if the editor provides the option.
  7. Preview the page on desktop and mobile.

The exact interface can vary depending on your theme and WordPress installation.

If your block theme doesn’t provide a sticky-position control, CSS remains an option.

Sticky Sidebar Using A Plugin

A plugin can make things easier when you want more control without manually writing CSS. Here are some options worth considering.

WP Sticky

WP Sticky is designed for making different website elements sticky. It provides a visual element selection approach, which can be useful if you don’t want to identify CSS selectors manually.

You can stick the sidebar, menu, CTAs, widgets and other fixed website elements. If you’re managing multiple sticky elements, a dedicated plugin can save time compared with writing custom CSS for each element.

WP Sticky Sidebar

WP Sticky Sidebar is another option specifically focused on sticky sidebar functionality.

It’s worth considering if you want a simpler sidebar-focused solution rather than a broader sticky-element tool.

CSS vs Plugin vs WordPress Blocks

Which Method Should You Use? Here’s how I would choose the method:

MethodBest forTechnical knowledge
CSSSimple sticky sidebarBasic CSS
GeneratePress CSSGeneratePress websitesBasic CSS
WordPress BlocksBlock themes with sticky positioningBeginner
Sticky pluginMultiple sticky elementsBeginner
Custom CSS + selectorsAdvanced customizationIntermediate

For my own WordPress work, I prefer CSS when the requirement is simple. Adding another plugin for a small CSS task isn’t always necessary.

On the other hand, if you need visual controls, multiple sticky elements, or device-specific settings, a plugin can be more convenient.

Sticky Sidebar Not Working? Try These Fixes

This is one of the most common problems people encounter after adding: position: sticky;

If your sidebar doesn’t stick, don’t immediately assume the CSS is wrong. Several layout conditions can prevent sticky positioning from behaving as expected.

1. Check the top Value

Make sure you have defined a top offset:

position: sticky;
top: 20px;

Without an appropriate inset value, the sticky behavior may not work as expected.

2. Check the Parent Container

This is one of the most important troubleshooting steps. An ancestor element with certain overflow settings can interfere with sticky positioning.

For example, check whether a parent container has:

overflow: hidden; or overflow: auto; or overflow: scroll;

If your sticky sidebar isn’t working, inspect the parent elements and check their CSS.

3. Check the Height of the Sidebar

If the sticky element is taller than the available viewport or its containing area, there may not be enough space for the expected sticky behavior. Try reducing unnecessary sidebar content and test again.

4. Check the Containing Block

A sticky element is constrained by its containing block. If the parent container ends earlier than expected, the sidebar will stop being sticky when it reaches that boundary. This is normal CSS behavior rather than a WordPress bug.

5. Check for Conflicting CSS

Another CSS rule may override your sticky declaration.

Use your browser’s Inspect tool and check whether: position: sticky; is being overridden by another rule.

You may also find that the theme or page builder applies a different positioning rule.

6. Check Your Header Height

If your header is sticky, don’t use: top: 0; without testing it.

Your sidebar may disappear behind the header. Try: top: 70px;

7. Check Your Mobile Breakpoint

If you’ve used: @media (min-width: 769px) {

the sticky effect won’t apply below 769px.

That’s intentional. If you want a different breakpoint, change it according to your layout.

How to Stop a Sticky Sidebar From Overlapping the Footer?

A common question is: Why does my sticky sidebar overlap the footer?

Remember that sticky positioning is constrained by its containing block. The sidebar doesn’t simply remain fixed forever.

If your layout isn’t structured correctly, the sticky element may visually collide with another section or appear to overlap the footer.

Check:

  • Sidebar height
  • Parent container
  • Footer spacing
  • Overflow properties
  • Theme layout
  • Sticky offset
  • Custom CSS
  • Page builder containers

If you’re using a page builder, inspect the parent containers carefully because their layout settings can affect sticky positioning.

Should You Use a Sticky Sidebar on Mobile?

In most cases, I recommend being cautious with sticky sidebars on mobile. A desktop sidebar may occupy only a small portion of the screen. On a mobile device, however, a sticky element can consume a significant part of the available viewport.

For this reason, I normally use a desktop-only rule:

@media (min-width: 769px) {
    .inside-right-sidebar {
        position: sticky;
        top: 20px;
    }
}

This allows the sidebar to behave normally on smaller screens. Always test the actual mobile experience instead of assuming that desktop behavior will translate well to phones.

My Experience

I’ve worked on WordPress websites for years, and I’ve found that the best sticky-sidebar setup depends heavily on the purpose of the sidebar.

On WPGlossy, I’ve used sidebar elements for things such as useful resources, promotional content, and calls to action. 

Rather than making every sidebar widget sticky, I prefer thinking about which information is genuinely useful to the reader while they’re scrolling.

I’ve also found that desktop and mobile need to be treated differently. A sticky element that looks perfectly fine on a wide desktop screen can become intrusive on a smaller device. 

My approach has become simple: start with CSS, test the actual page, check the mobile experience, and only introduce a plugin when I need more control.

Final Thoughts

A sticky sidebar is a small WordPress customization, but it can make a noticeable difference when used thoughtfully. Prefer the CSS method to enable this feature. 

And if you need to control several sticky elements without touching CSS, a dedicated WordPress sticky plugin may be more convenient.

I don’t recommend making a sidebar sticky simply because you can. Choose the content, test the mobile experience, and make sure the sticky element helps your visitors.

I have all possible methods of making WordPress sticky sidebar including for GeneratePress theme. If you face any difficulty in implementing this feature, catch me through the comment section.

by Nirmala Santhakumar

Nirmala Santhakumar is a professional blogger, WordPress enthusiast who has been blogging since 2010. She always loves to write useful WP tips, tricks and tutorials on this active blog. Sharing her SEO knowledge is her keen interest.

25 thoughts on “How to Make a Sticky Sidebar in WordPress (With or Without a Plugin)”

  1. It’s really great resource for me, I was despirately searching for creating sticky sidebars without any plugin.
    Thanks A Lot

    Reply
  2. Sakthi, this is some sweet coding here buddy. I love the look of a sticky sidebar. Makes things a bit more professional if done the right way. I reckon going sticky can boost conversions for specific ads too. Keep those eyes glued to it during the entire trip to your blog. Smart.

    Ryan

    Reply
  3. Hey Sakthi

    Indeed, a useful post.

    I am using 2 widgets on the right sidebar but both are not fixed.

    Will try to implement the above techniques to make them sticky.

    Thanks

    Reply
  4. Hello Sakthi,

    Another useful post from you.

    We followed your previous tips about the last updated date and it was very useful. Now, this post helped me in adding a sticky sidebar without a plugin.

    Previously, I was using Q2W3 Fixed Widget and now I have uninstalled it.

    Your code did the trick easily.

    It would be great if you can share another tutorial about showing the author bio on Generatepress without a plugin. I tried a few codes from Google but none worked.

    Thanks in advance.

    Reply
  5. Hi Sakthi,

    Thanks for the wonderful article.

    The sticky sidebar will make user interaction and user experience even better.

    I use Wp Sticky Sidebar, it’s a very nice plugin and it’s simple to customize the options.

    I have another blog where I can implement the Q2W3 Fixed Widget plugins.

    Thanks & Regards
    Sai Mithun

    Reply
  6. Hi Dear
    Thanks for sharing this awesome tips to sticky widget in generatepress theme. I’m using your last widget sticky css code for my website sidebar… Now it’s looks professonal.

    Great job.
    Trivanks

    Reply
  7. I love CSS code that you provide. Many times plugins can slow website speed. CSS code is good. Thanks for sharing.

    Reply
  8. Very useful post. I have looking for this sticky sidebar for more than two days. Now it became clarified to me. Anyway thanks for this fantastic post.

    Reply
  9. Sticky sidebar enhance the chances to get clicks on your desired content. CSS Approach to make the sidebar sticky is really helpful. Using css than a plugin is better in sense of website page speed.
    Overall good article. I enjoyed that.
    Thanks

    Reply
  10. Hello,

    It is working with the right sidebar, but when I use the same with the left-sidebar, the widget gets over the main content. Can you please help me fix this?

    Reply
  11. Such an excellent Blog! I like your content. I would Thanks for sharing this wonderful content. Its very useful to us.

    Reply

Leave a Comment