• Any chance someone would have a snippet of code which would allow me to change the logo on the admin bar. Nothing I’ve tried seems to work and I’m not sure why.

    For example, here is one I’ve tried which doesn’t work.

    function custom_admin_logo() {
    echo ‘<style type=”text/css”>
    #header-logo { background-image: url(‘.get_bloginfo(‘template_directory’).’/images/admin_logo.png) !important; }
    </style>’;
    }
    add_action(‘admin_head’, ‘custom_admin_logo’);

    The site is a wp 3.5 with latest BP installed on main site.

    Thanks.

    http://wordpress.org/extend/plugins/code-snippets/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter voopress

    (@voopress)

    Anyone supporting this?

    Plugin Author Shea Bunge

    (@bungeshea)

    I think that your CSS selector is wrong: I can’t find an element with the id of header-logo. You also need to set the background-position to 0 to you can actually see the image.

    Try this snippet instead:

    function custom_admin_logo() {
    	echo '<style type="text/css">
    	#wp-admin-bar-wp-logo > .ab-item .ab-icon {
    		background-image: url('  . get_bloginfo('template_directory') . '/images/admin_logo.png) !important;
    		background-position: 0 !important;
    	}
    	</style>';
    }
    add_action( 'admin_head', 'custom_admin_logo' );

    I’ve tested the above code on my own site (multisite; no BP). Enjoy!

    Thread Starter voopress

    (@voopress)

    Thank you, I’ll give that a try. Before I do, if I can ask one other question.
    I have seen the exact code I posted on many sites so am assuming that people grab each others articles and post them on their own sites as tips.

    The one thing that is always said is that the image must be /images/admin_logo.png yet when running an MU BP site, this directory doesn’t exist. I’ve tried putting the image in the BP themes images direct, the main sites wp-includes/images directory and nothing.

    I’m also not sure if they are saying that it must be named admin_log.png or if that’s simply a tip.

    I tried what I would prefer which is the site wide logo that I use at it’s own location in one of the uploads directories. I even copied the logo to the root of the entire install and still it doesn’t show.

    Plugin Author Shea Bunge

    (@bungeshea)

    You can put the image anywhere you like. You just need to change the bit inside url() on line 4. Currently, the code is looking for a image named admin-logo.png inside an images folder in the parent theme folder. If you’re using a child theme, you can uae this code instead:

    function custom_admin_logo() {
    	echo '<style type="text/css">
    	#wp-admin-bar-wp-logo > .ab-item .ab-icon {
    		background-image: url('  . get_stylesheet_directory_uri() . '/images/admin_logo.png) !important;
    		background-position: 0 !important;
    	}
    	</style>';
    }
    add_action( 'admin_head', 'custom_admin_logo' );

    If you prefer to place your image in wp-content/admin-logo.png, use this code:

    function custom_admin_logo() {
    	echo '<style type="text/css">
    	#wp-admin-bar-wp-logo > .ab-item .ab-icon {
    		background-image: url('  . WP_CONTENT_URL . 'admin_logo.png) !important;
    		background-position: 0 !important;
    	}
    	</style>';
    }
    add_action( 'admin_head', 'custom_admin_logo' );
    Thread Starter voopress

    (@voopress)

    Sorry for not updating this sooner but no, it never works.

    Also, I see this error in my http logs.

    [Wed Feb 27 08:57:11 2013] [error] [client 180.76.5.190] WordPress database error Table ‘compwp.wp_5_snippets’ doesn’t exist for query SELECT code FROM wp_5_snippets WHERE active=1; made by require(‘wp-blog-header.php’), require_once(‘wp-load.php’), require_once(‘wp-config.php’), require(‘/var/www/config.cfg’), require_once(‘wp-settings.php’), do_action(‘plugins_loaded’), call_user_func_array, Code_Snippets->run_snippets

    Thread Starter voopress

    (@voopress)

    [Wed Mar 06 09:25:13 2013] [error] [client 127.0.0.1] WordPress database error Table ‘compwp.wp_5_snippets’ doesn’t exist for queCT code FROM wp_5_snippets WHERE active=1; made by require_once(‘wp-load.php’), require_once(‘wp-config.php’), require_once(‘wp-settp’), do_action(‘plugins_loaded’), call_user_func_array, Code_Snippets->run_snippets

    The error log is jammed with similar errors. They seem to appear on almost all page loads.

    Thread Starter voopress

    (@voopress)

    Grr, silly moderator closed my other post because I posted the same error snippet. These are two different problems. One is my wanting to use code snippets to change the admin bar, the other is asking why these errors are showing up.

    Figured I’d post the same error here just in case they were related but now esmi has limited my getting help on this. Frustrating.

    [Both posts/topics were compared side-by-side. They were virtually identical in every respect.]

    Plugin Author Shea Bunge

    (@bungeshea)

    Hi voopress,

    This is actually an error with the current version of Code Snippets (1.6.1). I’ll have it fixed in the next version, but in the mean time you can remove it by visiting one of the Snippets admin pages on the blog with the ID of 5. Sorry for the inconvenience; I should have the next version released soon.

    Thread Starter voopress

    (@voopress)

    I don’t mind the error, it’s not affecting anything. I felt I should ask because I like to clean up errors as much as possible and not let them add up.

    It’s nice to see that you are maintaining this. Being able to use snippets helps to solve lots of small problems and eliminates the need for additional plugins.

    About the only problem I’ve found is no matter what code I’ve tried, I simply cannot change the admin bar logo. I have to use a plugin called “Custom Admin Bar” to achieve that.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Change admin bar logo on network install’ is closed to new replies.