Get inside access to design tips from a pro! Subscribe to Design to Dollars

GeneratePress

How to Create a Sticky Header in GeneratePress

Adam Wright

by Adam Wright

If you’re using GeneratePress and want to achieve a sticky navigation header that stays at the top of the page as users scroll, this guide will walk you through the steps to set it up. A sticky header can enhance user experience by keeping navigation options easily accessible. Let’s dive into how you can create this effect using GeneratePress.

Step 1: Access the Customizer

First, log in to your WordPress dashboard and navigate to the customizer:

  1. Go to Appearance > Customize.

Step 2: Enable Sticky Navigation

Once in the customizer:

  1. Go to Layout > Sticky Navigation.
  2. Turn on Sticky Navigation. You have the option to enable it for desktop only, mobile only, or all devices. For this example, we’ll enable it for all devices.

Now, as you scroll, you’ll notice that the navigation stays at the top of the page, but there are a few adjustments needed.

Step 3: Add a Logo for Sticky Navigation

The next step is to ensure that your logo is visible in the sticky header:

  1. Add a Logo: Scroll down to the Logo option and upload the logo you want to use in the sticky header.
  2. Optional Secondary Logo: You can also upload a secondary logo that appears only when the sticky header is active. This could be a more condensed or simplified version of your main logo.

Step 4: Adjust Sticky Header Size

To make your sticky header more compact:

  1. Adjust the Logo Size: Use the Menu Item Height setting to reduce the size of the logo in the sticky header. For example, you can set it to 45px for a sleeker look.

Step 5: Fix the Transparent Background

By default, the sticky navigation might inherit the transparent background of your primary navigation, making it hard to read when it overlaps text. To fix this, you’ll need to add some custom CSS:

  1. Go to Additional CSS in the Customizer.
  2. Enter the following CSS:
    .main-navigation.navigation-clone {
    background-color: #808080; /* You can adjust this color to match your design */
    }
    This CSS targets the sticky navigation specifically and sets a background color, ensuring the menu is readable as users scroll.

Step 6: Preview and Publish

Once you’ve made your adjustments:

  1. Preview the Sticky Header: Make sure everything looks good on both desktop and mobile views.
  2. Publish Your Changes: When you’re satisfied, hit the Publish button to save your changes.

Final Thoughts

While it would be convenient if GeneratePress allowed you to customize the sticky header background directly in the customizer, adding custom CSS is a quick workaround. With these steps, you now have a fully functional sticky header that enhances your site’s navigation.

This simple yet effective enhancement will improve your website’s usability and keep key navigation elements always within reach for your visitors.

Subscribe

Follow My YouTube Channel for More Tutorials

Subscribe to Channel
Adam Wright

About the Author

Adam Wright

Adam is a California native, now living in Middle Tennessee. A long-time creative at heart, his passion for design and growing his small business, AWD, is always evident. When he's not writing code or sketching logos, he enjoys spending time with family, playing basketball, or watching just about any motorsports. Find him on LinkedIn.