Skip to content

Instantly share code, notes, and snippets.

@carasmo
Last active June 17, 2016 13:09
Show Gist options
  • Save carasmo/d34a9e9dc5406f0172077602cff1d02d to your computer and use it in GitHub Desktop.
Save carasmo/d34a9e9dc5406f0172077602cff1d02d to your computer and use it in GitHub Desktop.
WordPress Admin Bar on the bottom without a plugin
<?php
//* don't use
/** ======================================================================================
*
* Admin Bar Bottom
*
* if you use the admin bar at the bottom on
* the backend add: html.wp-toolbar {padding-top:0px} to the CSS
*
======================================================================================= */
function wp_admin_bar_bottom() {
echo '
<style type="text/css">
html{margin-top:0px!important}.admin-bar{padding-bottom:32px}#wpadminbar{top:auto;bottom:0}@media screen and (max-width: 600px){#wpadminbar{position:fixed}}#wpadminbar .menupop .ab-sub-wrapper,#wpadminbar .shortlink-input{bottom:32px}@media screen and (max-width: 782px){#wpadminbar .menupop .ab-sub-wrapper,#wpadminbar .shortlink-input{bottom:46px}}@media screen and (min-width: 783px){.admin-bar.masthead-fixed .site-header{top:0}}
</style>';
}
//* on backend area
//add_action( 'admin_head', 'wp_admin_bar_bottom' );
//* on frontend area
add_action( 'wp_head', 'wp_admin_bar_bottom', 99 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment