Halloween Sale 15% off Ends in See the plans
PHP

Kadence: Message Bar Above the Header

Adds a slim announcement bar above the Kadence theme header on every page, using Kadence's own header hook.

Don’t have WPIDE yet? Install it on your site

Code

// Message to show above the header.
$wpide_kadence_bar = 'Holiday orders: order by <strong>Dec 18</strong> for delivery before Christmas.';

add_action( 'kadence_before_header', function () use ( $wpide_kadence_bar ) {
    if ( '' === trim( $wpide_kadence_bar ) ) {
        return;
    }

    echo '<div class="wpide-kadence-bar" style="background:#1f2937;color:#fff;text-align:center;font-size:14px;padding:8px 16px;">' . wp_kses_post( $wpide_kadence_bar ) . '</div>';
} );

Notes

Leave the message empty to hide it. Edit the colors in the inline style.

How to add this snippet

  1. Install WPIDE on your WordPress site (it is free) and open Code Snippets.
  2. Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
  3. It is added inactive: review the code and settings, then switch it on.

Have a snippet worth sharing?

Publish it to the library from WPIDE or right here. Sign in with any WordPress site that runs WPIDE, free or Pro. Public snippets are reviewed by the WPIDE team before they appear.

Which site should get this snippet?

Enter the address of your WordPress site. WPIDE opens there in a new tab with the snippet ready to review and save.

Remembered in this browser only, so you are asked once.

Report this snippet

Tell the WPIDE team what is wrong: broken code, something harmful, spam or copied work.