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

GenerateBlocks, GeneratePress

How to Add & Design a Top Bar using GeneratePress & GenerateBlocks

Adam Wright

by Adam Wright

If you’re looking to add a top bar, also known as an announcement bar, to your website using the GeneratePress theme and GenerateBlocks, this guide will walk you through the steps. A top bar is a great way to display important messages, promotions, or calls to action on your website. Here’s how you can set it up.

Step 1: Activate the Elements Module

Before getting started, ensure that the Elements module in GeneratePress Premium is activated:

  1. Go to Appearance > GeneratePress.
  2. Under Modules, ensure that Elements is activated.

Once activated, you’ll see the Elements option appear under the Appearance menu.

Step 2: Create a New Element

Next, you’ll create the top bar element:

  1. Go to Appearance > Elements.
  2. Click on Add New Element and select Block.
  3. Name it something like “Top Bar” or “Announcement Bar”.

Step 3: Design the Top Bar

Now, you can start designing your top bar using GenerateBlocks:

  1. Insert a Container Block: This will serve as the outer structure of your top bar.
  2. Add an Inner Container Block: This ensures your content stays within a certain width and doesn’t stretch across the entire screen.
  3. Set the Background Color: Select the outer container and choose a background color that matches your website’s theme.
  4. Insert a Grid Block: If you want to include both text and a button (or other elements), a grid layout can help you position these elements side by side.

Example Design:

  • Text Example: Insert a headline block that says something like, “Check out our newest product on sale!”
  • Button Example: Add a button block with text like, “View the Product.” Style the button with your brand colors and adjust the padding and spacing as needed.
  • Spacing and Alignment: Center the content and adjust padding for both the container and the elements inside to ensure everything is well-spaced.

Step 4: Set the Location

To make sure your top bar appears across your website:

  1. Go to the Location settings in the element editor.
  2. Set it to Display on the Entire Site.
    • Optional Exclusion: If the bar links to a specific page, you can exclude that page from showing the bar to avoid redundancy.

Step 5: Choose the Hook

To place the top bar in the right spot:

  1. Set the Element Type to Hook.
  2. In the Hook Name field, select before_header.

This ensures the top bar appears just above your main header and navigation.

Step 6: Publish and Preview

Once you’ve made your settings:

  1. Publish the element.
  2. Visit your site to preview the top bar. It should appear at the top of every page, above your navigation.

Step 7: Optimize for Mobile

Make sure the top bar looks great on all devices:

  1. Adjust Font Size and Spacing for Mobile: In the editor, switch to mobile view and tweak the font size, padding, and button alignment to ensure everything looks clean and easy to read.
  2. Preview on Mobile Devices: Use the WordPress Customizer to preview how the top bar looks on tablets and mobile phones.

Step 8: Managing the Top Bar

When you’re done with the announcement or need to update it:

  • Make the Element a Draft: If you want to remove the bar temporarily.
  • Update Content as Needed: Simply edit the content and publish it again whenever necessary.

Final Thoughts

Creating a top bar in GeneratePress using GenerateBlocks is a simple yet powerful way to highlight key messages on your website. Whether it’s for a promotion, a sale, or an important announcement, this feature can help you keep your visitors informed and engaged. Plus, you can easily toggle it on and off or update the content whenever needed.

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.