Skip to content

Instantly share code, notes, and snippets.

@bnecreative
Last active March 16, 2020 18:15
Show Gist options
  • Save bnecreative/1200a12172024d1022ae646e811f4b89 to your computer and use it in GitHub Desktop.
Save bnecreative/1200a12172024d1022ae646e811f4b89 to your computer and use it in GitHub Desktop.
Quick site banner
<?php
/*
* Plugin Name: Site Banner
* Version: 1.0
* Description: Adds a quick announcement banner to the top of your website.
*/
// Exit if accessed directly
if ( !defined('ABSPATH')) exit;
add_action( 'wp_footer', function() {
?>
<style>
.site-banner {
position: absolute;
top: 0;
left: 0;
right: 0;
margin: 0;
width: 100%;
font-size: 1em;
padding: 1em 0;
text-align: center;
background-color: #0099ff;
color: #fff;
z-index: 99998;
box-shadow: 0 1px 1em rgba(0,0,0,.2);
}
.admin-bar .site-banner {
top: 32px;
}
#wrapper {
top: 60px;
}
</style>
<div class="site-banner">
My text goes here.
</div>
<?php
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment