Add a custom script to the WordPress Admin Bar. It’s important that this is hooked into wp_head
, which will call the script on both the frontend and in the admin area.
Adding code to the WordPress Admin Bar
WordPress
// PHP
// Changing the Admin Bar height
function guyPrimavera_admin_bar() {
if ( is_admin_bar_showing() ) { // Check if the Admin Bar is currently showing
// Add your script here
}
}
add_action( 'wp_head', 'guyPrimavera_admin_bar', 99 ); // Hook into wp_head
Paste this snippet into your theme's functions.php or in a WordPress plugin.