-
-
Save tommcfarlin/a867844aeb9b32efbe3e38b43e19bb52 to your computer and use it in GitHub Desktop.
[WordPress] Manipulating WP Admin Bar Styles with Events
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
(function( $ ) { | |
'use strict'; | |
/** | |
* Hide all of the messages when the option is include and restore the menu items' | |
* default hover state style. | |
*/ | |
var hide_menu_notices = function() { | |
// Setup references to the plugin menu item and all admin notices. | |
var $admin_button = $( '#wp-admin-bar-toggle-admin-notices a' ), | |
$messages = $( '.notice, .warning, .error' ); | |
$admin_button.on( 'click', function( evt ) { | |
evt.preventDefault(); | |
$messages.toggle( 'medium' ); | |
$( this ).trigger( 'blur' ); | |
}); | |
}; | |
$(function() { | |
hide_admin_notices(); | |
}); | |
})( jQuery ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment