SNIPPET: How to move WordPress admin bar to bottom

Has the admin bar ever annoyed you at the top or just wanted to move WP admin bar to the bottom of the browser?

Use this snippet to move it to the bottom. Add this to your functions.php file in your child theme.

1 Comment

  1. i update this snippet
    function divi_engine_move_admin_bar_bottom() {
    echo '
    html {
    margin-top: unset !important;
    }
    html.js-focus-visible {
    margin-top: 172px !important;
    }

    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: 32px;
    }
    #wpadminbar{
    top:auto;
    bottom: 0;
    }
    #wpadminbar .menupop .ab-sub-wrapper{
    bottom: 25px;
    }
    @media all and (max-width: 600px){
    #wpadminbar{
    position: fixed;
    }
    }
    @media screen and (max-width: 575px){
    html.js-focus-visible {
    margin-top: 111px !important;
    }
    }
    @media screen and (min-width: 576px) and (max-width: 1024px){
    html.js-focus-visible {
    margin-top: 158px !important;
    }
    }
    ';
    }
    // Action to add CSS on WP admin
    add_action( 'admin_head', 'divi_engine_move_admin_bar_bottom' );
    // action to add CSS to frontend
    add_action( 'wp_head', 'divi_engine_move_admin_bar_bottom' );

Submit a Comment

Explore more from Divi Engine