Created
May 17, 2014 16:56
-
-
Save jaredatch/1cfc5435a5013b298abd to your computer and use it in GitHub Desktop.
Notice bar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($){ | |
// Notice bar | |
// Make sure and enqueue jquery cookie first - https://github.com/carhartl/jquery-cookie | |
var site_notice = $.cookie('site-notice'); | |
if ( site_notice == null ) { | |
$('#site-notice').prependTo('body').slideToggle(); | |
} | |
$('#site-notice .close').on( 'click', function() { | |
$('#sitenotice').slideToggle(); | |
$.cookie('site-notice', 'hide', { expires: 60 }); | |
return false; | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Site notice bar | |
* | |
* @since 1.0.0 | |
*/ | |
function ja_site_notice() { | |
$notice = get_option( 'ja_site_notice' ); | |
if ( !empty( $notice ) ) { | |
echo '<div id="ck-notice">' . $notice . ' <a href="#" class="close">Close</a></div>'; | |
} | |
} | |
add_action( 'genesis_after', 'ja_site_notice' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment