Addition to your code: prevent gap while adminbar is hidden
-
Hi Alex,
thanks for your plugin.
I added this code to your plugin to hide the “gap” at the top of website/dashboard while the admin-bar is hidden:
// Remove the top margin/padding of the admin bar, preventing a "gap" at the top of the page function remove_topmargin_front() { echo '<style type="text/css"> html { margin-top:0px !important; }'; echo '* html body { margin-top:0px !important; }</style>'; } add_action('wp_head', 'remove_topmargin_front',1000000); function remove_topmargin_admin() { echo '<style type="text/css"> html.wp-toolbar { padding-top:0px !important; }'; echo '</style>'; } add_action('admin_head', 'remove_topmargin_admin',1000000);
The topic ‘Addition to your code: prevent gap while adminbar is hidden’ is closed to new replies.