How to Create a Sticky Header in WordPress?

Last updated: September 29, 2024

Sticky Header in WordPress
Sticky Header in WordPress

Whether you’re looking for a quick way to make your website more user-friendly or just want to improve your WordPress website design, creating an attractive WordPress header is a great idea. This way, your menu items (and other header elements) are always visible and easily accessible. However, you may be concerned that this feature will be difficult to set up.

Fortunately, there are many ways to create sticky headers in WordPress, so you’re sure to find an option that suits your skill level and available time. Beginners can install a plugin or use the Full Site Editor (FSE) to simplify the process. More experienced users can create custom sticky headers using CSS.

In this article, we’ll take a closer look at sticky headers and discuss some best practices. Next, we will show you four ways to create catchy titles in WordPress. Let’s get straight to the topic!

Table of Contents:

  • Using plugins like Sticky Menu and Sticky Header
  • Add sticky headers with Complete page editor (FSE)
  • Create sticky headers with CSS
  • Install a premium theme with built-in sticky headers

What is a sticky header (and why should you use one)?

Fixed headers are also called “sticky headers” because the header remains visible even when visitors scroll down your page. This way, users can still access the navigation menu even as they interact with your site.

As such, sticky headers are a great way to improve user experience (UX) on your website, as it makes your web pages easily accessible. This helps people quickly find what they’re looking for, which can help you reduce bounce rate and increase time on site.

Even better, a catchy title encourages Encourage search visitors to explore other areas of your website. For example, if you run an e-commerce store, customers may see interesting products or categories listed in the header. This provides a valuable opportunity to increase your revenue.

Meanwhile, you can include all kinds of elements in your sticky headers. For example, you can provide a call-to-action button (CTA), which can increase conversions if always visible. You can also add your logo, social media links, shopping cart icons, or opening hours.

Best practices for creating a sticky header in WordPress

Since sticky headers will improve the UX of your site, it’s important to consider some best practices to ensure sticky headers are as user-friendly as possible. Here are the key factors to keep in mind:

Make it small – If your title is always visible, you don’t want it to take up too much screen space and interfere with your main content.

Keep it simple – While you should include useful elements like CTAs and logos, avoid filling your title with too many elements that can distract from your business.

Apply your brand colors – To ensure your title matches the rest of your website, you’ll need to choose fonts and colors that reflect your brand.

Focus on value – Since you don’t want your title to be overwhelming, it’s best to choose the most relevant menu items (and useful) to your visitors. For example, if you run an online store, you should prioritize the shopping cart icon and search bar.

Create a separate menu for mobile devices – Because mobile screens are much smaller than desktop screens, you can create a separate (smaller) sticky header with reduced font size and more hidden menu items. This way you can provide a better mobile experience.

Add hover animation – To make your header less intrusive, you should make it transparent when it first loads. When visitors hover over the header, you can change the background to a solid color to make your menu items easier to see.

It’s important to create an attractive, effective header for the title without distracting from your main content. It may take some experimentation to find the right balance, but the following methods will help simplify the process.

How to create a WordPress sticky header (4 methods)

Now that you know why it’s a good idea to create sticky headers, here are four ways to do it in WordPress. Each approach has its advantages and disadvantages. Therefore, we recommend that you read all four of these methods before choosing the one that best suits your website.

Use a plugin like Sticky Menu & Sticky Header

The easiest way to create a sticky header is to use a plugin. This is a beginner-friendly method as you don’t need to use any code. Additionally, the Sticky Menu & Sticky Header plugin works with almost any WordPress theme.

To get started, you will need to install the plugin through the WordPress dashboard. Go to Plugins → Add New and search for plugins using the search bar. Then click Install Now → Activate:

To set up your sticky header with the plugin, go to Settings in the WordPress sidebar and select Sticky Header (or whatever !). Since the plugin allows you to create all types of sticky elements, you’ll need to enter your theme’s header or class ID in the Sticky Element box.

If you don’t know your header or class ID, open your website in a new tab. Next, right-click on the header area and click Inspect Element.

Some settings of this plugin are only available with the premium version. For example, if you want to apply a background color to a fixed header, change the opacity, and add other effects, you’ll need to upgrade.

However, you can use the settings basically to set the spacing between headers and fixed headers. Additionally, you can disable sticky titles on very large or small screens, where sticky titles may not display correctly.

Then click Save Changes and test your sticky header on the front end.

Scroll down and see how the header responds. Does it still show up when you move somewhere else? Does he move smoothly? If so then you can go!

Add a sticky header using the Full-Site Editor (FSE)

If you’re using a block theme, you can create sticky headers using the built-in feature provided by the Builder Complete site (FSE).

If you don’t have one, you’ll first need to install a block theme like Neve FSE. This theme has a modern, minimalist design that’s suitable for many types of websites, like blogs, portfolios, or e-commerce stores.

Then, in the dashboard, Go to Appearance > Editor and find the template for your theme’s header. This will likely be stored in Templates or Templates but depends on the theme chosen.

In Neve, you will find it under Templates → Header → Header. Then click the pencil icon next to the template to get started.

Open Settings in the upper right corner next to the Save button. Select the header in the editor and click Group in the toolbar.

Alternatively, in block settings, you can click the group icon to gather all your elements into one container.

Now scroll down and open the Locations tab. Use the drop-down menu to select the Sticky option.

The title will appear transparent when scrolling, so you may want to apply a background color. To do this, switch to the Styles tab. You can also change the font style and size of the title there.

Finally, click Save and preview your sticky title at the front end of your website! You can always go back to make more changes until your title is perfect.

Create a sticky header using CSS

For more experienced users who don’t want to rely on plugins (or want more complete control), you can create sticky headers this way manually using CSS. To get started, open the WordPress Customizer by going to Appearance → Customize. Then, find the Additional CSS tab.

Enter the following code in the CSS box:


#site-navigation {
    background:#00000;
    height:60px;
    z-index:170;
    margin:0 auto;
    border-bottom:1px solid #dadada;
    width:100%;
    position:fixed;
    top:0;
    left:0;
    right:0;
    text-align: center;
}

You will need to replace “#site-navigation” with the CSS class or ID of the page’s en-header on your website. If you’re not sure how to find this code, see the related instructions in Method 1.

You can also change the title color by entering a different hexadecimal code after “background”. Additionally, you can customize the height, width, and other display settings by adjusting the relevant parts of the code. Then click Publish to upload your new title.

Install a premium theme with built-in sticky headers

The final way to create sticky headers is to install a theme with this feature built-in. Although this is the most expensive option, it allows you to add functionality without resorting to plugins or using code. This is great if you’re creating a new site and haven’t chosen a theme yet.

Many great themes come with ready-to-use fixed menus (or let you create existing menus). mine is sticky). Neve PRO is an example.

Even with the free version of Neve, you can create custom headers and footers using the intuitive drag-and-drop editor. However, you’ll get even more settings with the premium theme, such as advanced styling options and new components. This way, you can create movable headers, transparent headers, and fixed headers.

After installation and activation, go to Appearance > Customize in the dashboard of your WordPress site. Select the Header option.

Neve Pro allows you to configure multiple headers on your website and customize them. To create a sticky title, select the title and choose the Paste to top option.

To the right of this option, specify whether you want the title to stick across your computer device desktop, mobile, or both. Simply select the appropriate icons.

Then click Publish or continue customizing your title using Neve Pro’s built-in tools and options.

Conclusion

Fixed headers allow visitors to view and access menu items from any page on your site. Better yet, you can include elements like CTAs and company logos to improve brand recognition and boost conversions.

In short, here are four ways to create headlines hot:

  • Install plugins such as Fixed Menu and Fixed Header.
  • Add fixed header in Full Site Editor (FSE), using block theme like Neve FSE.
  • Create sticky headers with custom CSS.
  • Install a premium theme with built-in sticky headers, such as Neve PRO.