Frustré par la barre d’administration affichée en haut ? Vous souhaitez déplacer la barre d’administration de WordPress vers le bas ? Dans ce cas, il vous suffit de copier cet extrait dans votre fichier functions.php.
Instructions:
Il vous suffit d’ajouter ce code au fichier functions.php de votre thème ou dans un plugin spécifique à votre site:
function move_admin_bar() { echo ' <style type="text/css"> body {margin-top: -28px;padding-bottom: 28px;} body.admin-bar #wphead {padding-top: 0;} body.admin-bar #footer {padding-bottom: 28px;} #wpadminbar { top: auto !important;bottom: 0;} #wpadminbar .quicklinks .menupop ul { bottom: 28px;} </style>'; } add_action( 'wp_head', 'move_admin_bar' );
Note : Si c’est la première fois que vous ajoutez des extraits de code dans WordPress, veuillez vous référer à notre guide sur comment copier/coller correctement des extraits de code dans WordPress, afin de ne pas casser accidentellement votre site.
Si vous avez aimé cet extrait de code, n’hésitez pas à consulter nos autres articles sur le site comme : Les meilleurs constructeurs de pages WordPress (comparés).
For newer versions of WordPress:
function move_admin_bar() {
echo ‘
body {margin-top: -28px;padding-bottom: 28px;}
body.admin-bar #wphead {padding-top: 0;}
body.admin-bar #footer {padding-bottom: 28px;}
#wpadminbar { top: auto !important;bottom: 0;}
#wpadminbar .quicklinks .menupop .ab-sub-wrapper { bottom: 28px;}
#wpadminbar .quicklinks .menupop ul { bottom: 0;}
‘;
}
add_action( ‘wp_head’, ‘move_admin_bar’ );
Alright but this isn’t enough. The dropdown menu like “New -> Post” aren’t clickable because they still drop Down instead of UP.
I liked the admin bar at the bottom, but it’s no longer working properly. Maybe from WP version upgrades or something. But now the bar is at the bottom but the flyout menus go down instead of up – so now I can’t see anything except the first option. I just took it off for now, but I wanted to let you know. Thanks.
Hi Cliff, ill take a look at it and update the snippet.
I really like my Admin Bar at the bottom.
Currently, I only have it for Admin – I don’t have it on the public site.
However, the body margin:-28px affects my entire website, even when there’s no Admin bar present – even when not logged in as Admin.
There should be some conditional like “if Admin Bar is present, CODE”
Thanks.
Hi Cliff, if you look at the header of the site even when the admin bar is not visible you will see css. See this snippet
http://wpsnipp.com/index.php/functions-php/disable-the-new-admin-bar/
If you do this on a user level or ” if ( !current_user_can(‘author’)){ ” type of thing this should fix things for you.
I did a quick fix like that. Didn’t know if you had anything special up your sleeve. Thanks.
I did a quick fix like that. Didn’t know if you had anything special up your sleeve. Thanks.
Cool glad to hear you got things working.