Halloween Sale 15% off Ends in See the plans
PHP

OceanWP: Notice Bar Below the Header

Shows a notice bar right after the OceanWP header on every page, for announcements that should be seen but not block the menu.

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

Code

// Message to show.
$wpide_ocean_notice = 'New: same-day pickup is now available in store.';

add_action( 'ocean_after_header', function () use ( $wpide_ocean_notice ) {
    if ( '' === trim( $wpide_ocean_notice ) ) {
        return;
    }

    echo '<div class="wpide-ocean-notice" role="status" style="background:#13aff0;color:#fff;text-align:center;padding:10px 16px;">' . wp_kses_post( $wpide_ocean_notice ) . '</div>';
} );

Notes

Leave the message empty to hide it.

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.