Code & Snippets

How to Add a Notification Bar Above the Aurora Header

By Daniel Ekay May 18, 2026 2 min read
Docs Code & Snippets How to Add a Notification Bar Above the Aurora Header
Share:
Last updated:

A notification bar is a slim full-width strip that appears above the header on every page. It is useful for announcements, sale notices, or sitewide alerts. Aurora does not include one built-in, but wp_body_open gives you a clean hook to add one from your child theme.

Child theme folder structure showing style.css, functions.php and other child theme files

Basic Notification Bar

Add this to your child theme’s functions.php:

add_action( 'wp_body_open', function () {
    echo '';
} );

Then add the styles in Appearance → Customize → Additional CSS or your child theme’s stylesheet:

.aurora-notice-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background-color: var(--link-color);
    color: #fff;
    font-size: 13px;
    padding: 10px 20px;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

.aurora-notice-bar a {
    color: #fff;
    text-decoration: underline;
}

.aurora-notice-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    position: absolute;
    right: 16px;
}

Remembering the Dismissal

To remember that a visitor dismissed the bar across page loads, use localStorage. Replace the inline onclick with a script:

add_action( 'wp_body_open', function () {
    echo '';
    echo '';
} );

This bar appears on every page of your site. For a banner that only appears on the homepage between post blocks, Aurora’s built-in custom content sections are the simpler option. No code required.

Make your blog stand out

Enjoy the ease and flexibility of Aurora. Create stunning blog designs your readers will love, with live preview editing and effortless template mixing and matching enabled.

Get Aurora today for just $39

Get Aurora