
- Log in to your WordPress site using admin credentials
- Install code Snippet Plugin
- Add New Snippet
- Add the following code and only run at the site front end
function lwp_4056_bottom_admin_bar()
{
?>
<style>
div#wpadminbar {
top: auto;
bottom: 0;
position: sticky;
}
.ab-sub-wrapper {
bottom: 32px;
}
html[lang] {
margin-top: 0 !important;
margin-bottom: 32px !important;
}
@media screen and (max-width: 782px){
.ab-sub-wrapper {
bottom: 46px;
}
html[lang] {
margin-bottom: 46px !important;
}
}
</style>
<?php
}
function lwp_4056_check_username()
{
if(is_admin()) return;
$user = wp_get_current_user();
if($user && isset($user->user_login) ) { //&& 'johndoe' === $user->user_login
// Remove extra conditions after $user from above to apply for everyone
add_action('wp_head', 'lwp_4056_bottom_admin_bar', 100);
}
}
function habfna_hide_admin_bar_settings()
{
?>
<style type="text/css">
.show-admin-bar {
display: none;
}
</style>
<?php
}
function habfna_disable_admin_bar()
{
if(!current_user_can('administrator'))
{
add_filter( 'show_admin_bar', '__return_false' );
add_action( 'admin_print_scripts-profile.php', 'habfna_hide_admin_bar_settings' );
}
elseif (!is_admin()) {
//if(is_admin()) return;
$user = wp_get_current_user();
if($user && isset($user->user_login) ) { //&& 'johndoe' === $user->user_login
// Remove extra conditions after $user from above to apply for everyone
add_action('wp_head', 'lwp_4056_bottom_admin_bar', 100);
}
}
}
add_action('init', 'habfna_disable_admin_bar', 9);
//add_action('init', 'lwp_4056_check_username');