Website Design and Graphic Designer - WordPress Sticky Header Tutorial
Creating a sticky header in WordPress is a smart way to enhance website navigation and user experience. A sticky header remains fixed at the top of the screen as visitors scroll down your site, keeping key links like menus, contact buttons, or shopping carts always visible. Whether you’re building a blog, portfolio, eCommerce store, or business site, adding a sticky header can help drive conversions and boost usability.
In this tutorial-style blog post, we’ll go over multiple options for implementing a sticky header in WordPress. You don’t need to be a developer to follow along—there’s a method for every skill level.
1. Use a WordPress Theme with Built-In Sticky Header
The easiest option is to choose a WordPress theme that already includes a sticky header feature. Many modern themes like Astra, OceanWP, GeneratePress, and Neve offer this functionality out of the box. Typically, you can enable the sticky header via the theme customizer or theme settings panel under the “Header” section. No coding or plugins required.
If you’re planning a new site or redesign, selecting a theme with this built-in feature can save you time and ensure smooth compatibility across devices.
2. Install a Sticky Header Plugin
If your current theme doesn’t offer sticky header support, using a plugin is a fast and beginner-friendly option. Popular plugins include:
-
myStickymenu – This plugin lets you stick the menu or any element at the top of the page. It’s easy to use and highly customizable.
-
Sticky Menu (or Anything!) on Scroll – Allows you to make any element sticky, not just headers. Simply input the CSS class or ID of the element you want to fix at the top.
-
Elementor Pro – If you’re using Elementor as your page builder, it has a built-in sticky header function. You can enable it in the “Motion Effects” settings.
These plugins are ideal if you want to implement sticky headers without editing code, and many offer advanced options like fading effects or hiding on scroll.
3. Use Custom CSS
For users with a bit of technical knowledge, adding custom CSS can be a lightweight and flexible way to create a sticky header. Here’s a basic example:
.site-header {
position: sticky;
top: 0;
z-index: 9999;
}
You can add this CSS in Appearance > Customize > Additional CSS. Make sure .site-header
is the correct class for your theme’s header. You may need to inspect your site using browser developer tools to find the right selector.
This method is minimal and avoids plugins, but keep in mind that not all themes support position: sticky;
well without additional tweaks.
4. Use JavaScript or jQuery for Advanced Effects
For developers or advanced users, adding JavaScript or jQuery can provide more dynamic behavior, such as shrinking the header or changing its background on scroll. This method requires coding skills and should be done through a child theme or a plugin like Code Snippets.
For example:
jQuery(function($){
var header = $('.site-header');
$(window).scroll(function(){
if($(this).scrollTop() > 100){
header.addClass('scrolled');
} else {
header.removeClass('scrolled');
}
});
});
You’d pair this script with custom CSS to style the .scrolled
class.
Conclusion
Adding a sticky header in WordPress is achievable in several ways—from no-code plugins to custom CSS or advanced JavaScript. Whether you’re a beginner or developer, there’s a method to suit your needs and your theme’s capabilities. Choose the option that best fits your workflow and enhances your site’s usability for your visitors.
Scroll below to view websites and graphic design and View more of my work online at http://yourokanagan.ca
We also work with a branding and advertising company that creates custom temporary tattoos of your business logo to advertise your brand. View them online at https://customtemporarytattoo.weebly.com/
Recent Websites Designed:
https://www.austinroofing.ca
https://www.onealmfgservices.com
https://www.houstonremodelingcontractors.com/
https://miamitile.com/
https://rjt-constructionllc.com/
https://luxuriousconstruct.com/