How to Add an Announcement Bar in WordPress

How to Add an Announcement Bar in WordPress

A sale starts tomorrow, delivery times have changed, or you’ve launched something new. You need every visitor to see it, but a popup feels intrusive and a homepage banner only reaches people who land on the homepage. A WordPress announcement bar solves this: a slim strip at the top of every page with one short message and an optional button.

In this guide, you’ll learn how to add an announcement bar to WordPress with a plugin or a short code snippet, how to schedule it and target devices, and how to write a message people actually click.

What Makes a Good Announcement Bar?

  • One message: a single, specific sentence.
  • One action: an optional button that takes visitors straight to the relevant page.
  • Dismissible: visitors can close it, and it stays closed.
  • Timed: it appears when the offer starts and disappears when it ends.
  • Light: it loads instantly and doesn’t push your layout around.

Announcement Bar Ideas That Work

Goal Example message Button
Promote a sale Spring Sale: 20% off everything until Sunday Shop the sale
Free shipping Free shipping on orders over $50 Start shopping
Service update Orders placed after Thursday ship next week See delivery dates
New launch New: our course on WooCommerce speed Learn more
Lead generation Free site audit for the first 20 businesses Book yours

How to Add an Announcement Bar With a Plugin

Step 1: Install an Announcement Bar Plugin

InfoBar from Simpli Plugin is a free, lightweight announcement bar with the features that matter: a dismissible bar, scheduling, device targeting and a call-to-action button.

  1. Download the plugin ZIP from its product page.
  2. Go to Plugins → Add New Plugin → Upload Plugin.
  3. Upload the file, click Install Now, then Activate Plugin.

Step 2: Write the Message and Button

Open the plugin settings, enter your message and add a button label and link. Keep the message under about 70 characters so it fits on one line on most phones.

Step 3: Schedule It

Set a start and end date that match your offer. An expired sale still showing next week damages trust, and scheduling removes the need to remember.

Step 4: Choose Devices

Show the bar on all devices, or limit it to desktop or mobile. A short, mobile-only bar can work well for “Tap to call” or WhatsApp messages.

Step 5: Style and Test

Use a background color that contrasts with your header, keep the text readable and check the bar on a phone before you go live.

Want bars that change by page, country or customer type, or that connect to your email tool? Simpli Plugin’s team builds custom WordPress marketing features.

Talk to Our Developers →

How to Add an Announcement Bar With Code

For a simple, permanent bar, developers can use the wp_body_open hook, which runs right after the opening body tag in modern themes:

add_action( 'wp_body_open', function () {
    echo '<div class="site-announcement">Free shipping on orders over $50. '
        . '<a href="/shop/">Start shopping</a></div>';
} );

Then style it in your theme’s custom CSS:

.site-announcement {
    background: #1d4ed8;
    color: #fff;
    text-align: center;
    padding: 10px 16px;
    font-size: 15px;
}
.site-announcement a {
    color: #fff;
    font-weight: 700;
    text-decoration: underline;
}

This snippet has no scheduling, dismiss button or device targeting. Add it through a child theme or a small custom plugin, and check that your theme calls wp_body_open().

Announcement Bar Best Practices

  • Be specific. “20% off until Sunday” beats “Big sale now on.”
  • Link deep. Send visitors to the sale collection, not the homepage.
  • Avoid stacking. One bar at a time. A bar plus a cookie banner plus a popup feels cluttered.
  • Watch layout shift. Bars that appear after the page loads push content down. Prefer bars that load with the page.
  • Retire it. Remove or replace the message as soon as it’s out of date.

Common Problems and How to Fix Them

The Bar Doesn’t Show

Check the schedule dates and device settings, then purge your page cache and CDN.

The Bar Overlaps a Sticky Header

Your theme positions the header on top of the page. Adjust the header’s top offset in custom CSS, or turn off sticky positioning for one of them.

Dismissed Bars Keep Coming Back

Dismissal is usually stored in the visitor’s browser. Private windows and cleared browsers will show it again, which is expected.

Frequently Asked Questions

Do announcement bars slow down a site?

A lightweight bar adds very little. Avoid plugins that load large scripts for a single line of text.

Are announcement bars better than popups?

For short, site-wide messages, yes. They’re less intrusive and don’t block the page.

Can I show different messages on different pages?

Some plugins support page targeting; otherwise, custom code can show a bar only where you need it.

Get Your Message Seen

An announcement bar puts your most important message in front of every visitor without getting in their way. Keep it short, schedule it, link it to the right page and remove it when it’s done.

Download InfoBar for free, and browse the full Simpli Plugin library. If you need custom marketing features, our developers can build them.

Request a Custom Plugin →