Add this in your child theme’s functions.php:
add_filter('tc_logo_text_display', 'your_logo_display'); add_filter('tc_logo_img_display', 'your_logo_display'); function your_logo_display($output) { return preg_replace('/brand span3/', 'brand span10 offset1', $output, -1); }
25 thoughts on “Center the logo”
How to customize logo only?
If i change
in css, then transformed also some other images.
Is there a CSS code to enlarge the logo picture?
IS THERE ANY WAY I CAN MOVE MY LOGO DOWN RIGHTT NEXT TO MY NAVAGATION BAR.
Can I adjust the size of the logo? Ex. make my logo larger og reduce the width of the menu-bar? If yes, where and how?
I loaded up the code into Functions.php exactly in my child theme but it appears as text on my website. I’m thinking this is because the only code I have on there is the code posted above which isn’t being “read” correctly.
Can someone please post the entire code just so I can sample it?
Thanks
Centering is nice, but any idea how I can make the logo bigger without overlapping it with the menu and as CSS only?
The best place to ask for additional functionality to the theme or existing snippets is the theme’s WP support forum.
I’m using the following in the child theme functions.php but can’t get the logo to center over the menu. It simply doesn’t move:
What am I missing?
As of 3.0.14 the hook for logo changed from “tc_logo_title_display” to “tc_logo_img_display” if you have a logo and “tc_logo_text_display” if it uses the site title (you don’t have a logo).
I just updated the snippet to work for 3.0.14. Thank for pointing this out.
Worked easy a pie. Thanks for these little tweaks!
Jodie
Hi Andrei/Everyone,
Just looking for a little advice here. I have no issues with anything else other than centring my logo and have tried a variety of codes, posted here and elsewhere without success. Is there something I’m missing?
Thanks
Mike
Sorry to reply as late as this, haven’t noticed your comment before. If the solution above doesn’t work for you I suggest opening a thread on the WP theme’s forum, providing a link to your website so I can check why it’s not working. It’s also important that you specify what version of the theme you have and any other snippets you might be using. Hopefully we’ll get to the bottom of this.
Also, I had to use:
if ( ! function_exists( ‘theme_special_nav’ ) ) {
function theme_special_nav() {
// Do something.
}
}
Found
http://codex.wordpress.org/Child_Themes
To override the other use of the logo to keep the error from coming up.
David, the condition above checks if the function “theme_special_nav” exists. If it doesn’t exist, it declares it and “//do(es) something”. If it already exists, it doesn’t do anything. In the snippet above I haven’t declared any “theme_special_nav” function. I’m only declaring the “your_logo_display” function, which, in turn, could be renamed to “any_function_name_you_want_and_does_not_already_exist”. Just make sure you use the same exact name in add_filter() above it.
It worked great. There tends to be a large amount of blank space at the bottom of the logo before the next section picks up. Any good way to reduce the empty space?
David, did you figure out how to adjust that extra space below your logo?
Centered the Logo. Works just as advertised.
Thanks Andrei
I wonder how I do to make it on the menu? Center it also along with the menu items.
Posted a solution for this here. Centers logo, tagline and menu. Also, the menu items do not float left or right, they float centered. If they fill up a row, they start floating centered on second row and so on…
Does it matter where in the child functions.php this is placed?
No, but it has to be between the starting <?php and the ending ?>. Also, make sure you don’t place it in another function.
I just used this one for a client website!
Thanks!
I almost blushed, Nicolas. You’re most welcome.
As our resident php expert, how do you decide whether to do this kind of change in php or css?
Appreciate your contributions to the Forum, helping me start to understand php much better, despite reading books/tutorials!
We are basically doing the same thing: making sure the logo container spreads to full page width. I find my solution, in principle, a little less aggressive, as instead of applying a CSS rule that overrides the normal behavior of the assigned Bootstrap class, it changes that class on the fly with a wide one and lets Bootstrap work as intended. Theoretically, on a very large scale, my method produces lighter code, with less CSS overrides, which speeds up the rendering/browsing process, but it outputs the code slower, as it has a preg_replace to run. In the end, I really can’t figure out which one would be faster by a second or two over a couple of centuries.