If you want this logo to show up across your network sites regardless of the theme I’d advise you to create a new PHP file inside wp-content/mu-plugins
(create the directory if it doesn’t exist) and drop that code inside the new file. You can name your file whatever you like – for example my-network-tweaks.php
. That file will be loaded automatically as a plugin on all of the sites.
And if you’d like to override this image for a particular site you can make that function pluggable. Like this:
<?php
//hook the administrative header output
add_action('admin_head', 'my_custom_logo');
// if override function exists load it up instead
if(function_exists('override_my_custom_logo')) {
function my_custom_logo() {
override_my_custom_logo();
}
// fallback to original function
} else {
function my_custom_logo() {
echo '
<style type="text/css">
#header-logo { background-image: url('/path/to/images/custom-logo.gif) !important; }
</style>
';
}
}
?>
Note that I’ve changed the image path because we want it to point to a single file for the whole network. Using get_bloginfo('template_directory')
would cause it to load the image from the theme directory.
If you want to override the image for a single site, just use Tom J Nowell’s code renaming the function to override_my_custom_logo