Skip to content

Instantly share code, notes, and snippets.

@someguy9
Last active April 2, 2020 23:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save someguy9/797262b1a4c02966946dde97495aa361 to your computer and use it in GitHub Desktop.
Save someguy9/797262b1a4c02966946dde97495aa361 to your computer and use it in GitHub Desktop.
Adds a custom logo to the top left of the WordPress admin
<?php
//Adds a custom logo to the top left of the WordPress admin
function smartwp_custom_logo_wp_dashboard() {
echo "<style type='text/css'>
#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon:before {
background-image: url('" . get_bloginfo('stylesheet_directory') . "/admin-icon.png');
background-size: contain;
background-position: 0 0;
color:rgba(0, 0, 0, 0);
}
#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon {
background-position: 0 0;
}
</style>";
}
add_action('wp_before_admin_bar_render', 'smartwp_custom_logo_wp_dashboard');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment