Add Custom Text to the Divi Top Header

Written by Dan Mossop

In this guide we show you how to add custom text to the Divi Top Header. Learn how to display custom messages or information prominently at the very top of your website by adding text to the Divi Top Header. This allows you to communicate important announcements, contact details, or promotional content to your visitors in a highly visible area. 

Add Custom Text to the Divi Top Header using Divi Booster

This method demonstrates how to display custom text in the Divi Top Header by using the Divi Booster plugin. It provides a straightforward interface to add your text (including HTML), and also shows how you can optionally hide this text on mobile devices by applying a simple CSS snippet for a more tailored mobile experience.

Access Divi Booster Header Settings

Navigate to the "Divi Booster" settings via the Divi menu in your WordPress dashboard. Once there, expand the "Header" section, then the "Top Header" subsection to reveal the relevant options.

Add Your Custom Top Header Text

Enable the option labeled "Add text to top header." You'll now see a text field where you can enter your custom message. You can use plain text or enhance it with HTML tags. Example:

<strong>Welcome!</strong> Contact us at <a href="mailto:info@example.com">info@example.com</a>

Save and Review Your Changes

Once your message is entered, save your settings by clicking the "Save Changes" button. Visit your site to confirm your custom text appears at the very top header as expected.

(Optional) Hide Top Header Text on Mobile Devices

If you'd like your custom top header text to only appear on desktops and larger screens, you can hide it on mobiles using a small CSS tweak. Go to Divi > Theme Options and scroll to the "Custom CSS" area. Paste the following code:

@media only screen and (max-width: 980px) {
  #db-info-text {
    display: none;
  }
}

Click "Save Changes" to apply. Now resize your browser window or use a mobile device to confirm the top header text is hidden on smaller screens.

Add Custom Text to the Divi Top Header using jQuery

This method demonstrates how to add custom text to the Divi top header by inserting a jQuery script via the Theme Options Integration panel. It’s a flexible approach that allows you to dynamically inject and style your text site-wide without modifying theme files.

Paste jQuery Code into Divi Theme Options Integration

Head over to Divi > Theme Options and click the "Integration" tab. In the section labeled "Add code to the of your blog," paste this script, customizing the text as needed:

<script>
// Add custom text to Divi top header
jQuery(function($){
  if (!$('#top-header .container #et-info').length) {
    $('#top-header .container').prepend('<div id="et-info"></div>');
  }
  $('#top-header .container #et-info').prepend('<span style="margin:0 10px">Custom top header text</span>');
});
</script>

Save your changes.

Enable the Top Header (if you haven't already)

If you don't yet have a top header active on your site, you'll need to enable it. In Divi, this is done by adding elements to the header, such as social icons, a phone number or an email address. For this example, we'll enable social icons. Open the Theme Customizer (Divi > Theme Customizer), expand the "Header & Navigation" > "Header Elements" section, and turn on the "Show Social Icons" option. Don’t forget to click "Publish" to save.

Review the Top Header Text

Once everything is set, visit your site’s homepage. Your custom message should now be displayed in the top header.

Conclusion

With these simple steps, you can easily showcase custom messages in your Divi site's top header—perfect for announcements or contact info. You also have options to control how (and where) that message appears, providing a polished experience for both desktop and mobile visitors.

We may earn a commission when you visit links on our website.

Enhance Your Divi Site Effortlessly

Unlock a world of customization with Divi Booster. Easily add text to your top header and more with hundreds of powerful options. Perfect for tailoring your website to perfection without touching code.

Latest Posts

Set Custom CSS IDs for Individual Divi Accordion Items

Assigning unique CSS IDs to specific Divi Accordion items allows for precise control over styling, targeting, and linking within your page content. This ability is particularly useful when you want to apply custom designs or create anchor links to particular accordion...

Enable Swipe Navigation in the Divi Gallery Lightbox

Enabling swipe navigation in the Divi Gallery module's lightbox allows users to seamlessly browse through gallery images by swiping left or right, creating a more interactive and mobile-friendly experience. This functionality can significantly improve user engagement...

Disable Slide-In Animation for Divi Gallery Grid Images

Control how images appear in your Divi Gallery module by toggling the slide-in animation effect for grid layouts. Disabling the slide-in animation allows gallery images to load instantly and appear statically, providing a faster and distraction-free browsing...

Control Image Count Display in Divi Gallery Lightbox

Displaying or hiding the image count in the Divi Gallery module’s lightbox can help customize the user experience, depending on whether you want to give visitors an indication of gallery progress or prefer a cleaner, distraction-free view. The ability to toggle this...

Hide Gallery Image Titles in the Divi Lightbox Overlay

Displaying image titles in the lightbox overlay of the Divi Gallery module can sometimes be distracting or unnecessary, depending on your website’s design and user experience goals. Hiding these titles creates a cleaner and more focused viewing experience for visitors...

Random Posts

About Dan Mossop

Dan is a Scottish-born web developer, now living in Brisbane with his wife and son. He has been sharing tips and helping users with Divi since 2014. He created Divi Booster, the first Divi plugin, and continues to develop it along with 20+ other Divi plugins. Dan has a PhD in Computer Science, a background in web security and likes a lot of stuff, 

62 Comments

  1. Hello Dan,

    at the moment the plain text is on the right site but unfortunately after the custom links. how can I remove the plain text to the first place?

    Here is an example: NOW: Facebook, Email, CONTACT US:
    Should be: CONTACT US: Facebook, Email

    Thank you & best

    Reply
    • Hi Inna,

      Assuming you're working on the blackhatcoffee.de site linked in your comment, I think this variant should work for you:

      jQuery(function($){
          $('#et-secondary-menu').prepend('Contact Us:');
      });
      

      The reason for the difference is that your facebook / email links are being added as menu items, rather than using Divi's customizer options. The code above takes that into account.

      Reply
  2. Hi,

    Thank you. It is very helpfull. I want the shop icon with the text webshop. How do I get the icon in this line?

    Kind regards,
    Angelique

    Reply
    • Hi,

      I got the icon in line, but it is not visible at the homepage. At all pages it is, except at the homepage. Someone an idea who come?

      Kind regards,
      Angelique

      Reply
      • Hi Angelique, as far as I can tell, the problem is that the font awesome plugin you're using to add the icon isn't loading on the homepage. Its CSS / font file aren't being loaded on the homepage, which is why the cart icon isn't being displayed. I'm not familiar with the plugin, but I'd suggest first checking its settings to see if there are any settings that might disable it from running on the homepage. If not, then your best bet would probably be to contact the plugin authors to see if they can advise you on how to get it to apply on the homepage.

        If you aren't able to get an answer from them, let me know and I'll try to help out.

        Reply
  3. Hi Dan –

    This worked perfectly for me, but I had a question.

    I have the phone number floated right – is there a way to get this text I am adding to float left?

    Thanks!

    Reply
    • Hi Joe, something like this might work for you:

      #et-info>span:first-of-type { position: absolute; left:0; }
      

      If not, any chance you can send me a link so that I can see exactly how your top header is set up?

      Reply
    • Sure, you should just need to change the line that actually adds the text to something like this:

      $('#et-info').prepend('<span style="margin:0 10px"><a href="http://mysite.com">Welcome to my website</a></span>');
      

      Just replace http://mysite.com with your URL of choice.

      Reply
      • Hi Dan,

        I am new to this, but where would I edit this line?

        Reply
        • Hi Adrian, this is a modification to the code given in the post. If you look at that code you'll see a line that begins "$('#et-info').prepend". You just need to replace that entire line with the one given in my comment. Hope that makes sense!

          Reply
          • It would be great to have the option to include a link in the dialog box in Divi Booster rather than having to do it via Javascript.

          • Hi Maggie, I'm with you on that. I'm hoping to add it as an option in a future version :)

          • Hi Dan,
            Can you please advise in which php file of the theme to search for the code that begins with “$(‘#et-info’).prepend”?

          • Hi Mila, you don't need to search the theme's PHP files for that line. The line of code that needs to be modified is the 5th line of the jQuery code given in the post above (in the "Adding Text to the Top Header using jQuery" section).

  4. If I use this to put my tagline in the top header, is there a way to add a superscript TM after it?

    Reply
    • Hi Penny, you can use the HTML code for the trademark symbol: &trade;

      In the above example, you'd place it right after the word "website", and before "</span>".

      Reply
  5. Is there anyway to get this to work without having anything else in the top bar? Currently you have to either add the phone/email, or add the secondary menu. I don't want any of that. All I want is the text I had through the Divi Booster.

    Reply
    • Hi Jon, at the moment this code needs the secondary bar to be visible to work. There are a couple of ways to get the secondary bar showing without having anything else in it:

      1. If you don't intend to use social icons in the footer, you can enable the option to "Show Social Icons" in the customizer, but then disable each of the individual social icons in the Theme Options.

      2. Put some value in as the phone number (so that it shows and activates the secondary header), then hide the phone number with this CSS:

      #et-info-phone { display: none; }
      

      I'll try to update the code in the future to remove the need to do this.

      Reply
  6. Thanks for this.

    I've enabled this feature using Divi Booster, however, the text appears on the left hand side of the top bar.

    Is there a way to easily centre it?

    See current layout on the website here: http://kesnet.co.uk

    Reply
    • You're welcome, Paul. I think this should do the trick:

      #et-info { position: relative; left: 50%; transform: translate(-50%, 0%); }
      
      Reply
      • Thanks Dan!

        That worked perfectly.

        Reply
      • Where does this line go? Sorry so confused.

        Reply
  7. thanks mate its working divi 3

    Reply
  8. This does not work on divi 2.7.8

    Reply
    • Hi Peter, I just tested it on my own Divi 2.7.8 installation and it is working correctly for me. Are you able to share a link to your site? Hopefully I can spot what's causing it to fail for you.

      Reply
    • Hey Paul, are you talking about the Shop / My Account / Checkout links? If so, they'll have done this by creating a standard WP menu (Appearance > Menus), and setting the Theme Location for the menu as "Secondary Menu". This will let you have a menu similar to the main Divi menu, though I don't think it will directly allow you to add plain text.

      Reply
  9. Hello,

    This is a good feature.

    However, It would be very good if you could add more than only test.

    Like widget (search for exemple), images, tags (like post title)

    Regards

    David

    Reply
    • Hi David, yeah these would be good to be able to do. I'll look into adding information on how to do this in the future.

      Reply
  10. Using Divi Booster. This doesn't seem to work, if there's no phone or email. I personally don't like that the email only works for mailto: links and want it to link to the contact page instead. So in most cases I just create my own phone and email links as menu items. I'd like to display a message up there on a project I'm currently working on, but have no use for the phone and email links. Yet without them, I can't display this message. Is there a way to add it without displaying those?

    Reply
    • Hi Tevya, yes it looks like it was a bug in my code. I've just released an update to Divi Booster (v2.1.8) to fix this. If you upgrade you should be able to display the text without needing the phone / email to be showing. I've similarly updated the code in the post above. Thanks!

      Reply

Submit a Comment

Comments are manually moderated and approved at the time they are answered. A preview is shown while pending but may disappear if your are cookies cleared - don't worry though, the comment is still in the queue.

Your email address will not be published. Required fields are marked *.