Javascript,Nodejs,MongodDB,WordPress,CSS,PHP

LightBlog

Monday, August 20, 2018

How to add custom dashboard logo in wordpress


This is post is related to change by default dashboard logo of wordpress.

this is very simple to change dashboard logon in wordpress,just copy  this code in your wordpress functions.php file.



<?php

function change_dashboard_logo() {
echo '
<style>
#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon:before {
background-image: url(' . get_bloginfo('stylesheet_directory') . '/images/custom-logo.png') !important;
background-position: 0 0;
color:rgba(0, 0, 0, 0);
}
#wpadminbar #wp-admin-bar-wp-logo.hover > .ab-item .ab-icon {
background-position: 0 0;
}
</style>

}
//hook into the administrative header output
add_action('wp_before_admin_bar_render', 'change_dashboard_logo');
?>

Note: where  /images/custom-logo.png is your image path
and wp_before_admin_bar_render hook

No comments:

Post a Comment