Blog

Sharing WordPress tips and tricks as I find them

Clickable Logo in Header in Thesis

This post has been marked as old. The code might no longer work. Comments have been disabled as this is no longer maintained. Use the search on the right to find a newer tutorial.

Update: As of Thesis 1.8, you can use the new Header Image option in the Thesis menu. In the admin area just go to Thesis > Header Image to upload your image. The way described below still works (and is what I do), but this new way will let you add a logo without editing code.

One of the most common modifications to the Thesis theme is replacing the header text with your own custom logo or image. What a lot of people forget to do is add a bit more code to make that logo clickable.

  1. First, upload your logo to the  /custom/images folder.
  2. Go to Thesis Options, and click “Header” under Display Options. Make sure “Show site name in header” is selected (it is by default).
  3. Open custom.css, and paste the following code. Make sure you change the height and width to match your logo’s dimensions:

.custom #logo {background-image: url('images/logo.jpg'); background-repeat: no-repeat; width: 170px; height: 145px; text-indent: -9999px; }
.custom #logo a {width: 170px; height: 145px; display: block; outline: none;}

That second line is what a lot of people forget. If you don’t include it, you’ll have the logo up there but it won’t be clickable. Now, when someone clicks it they are sent to the homepage.

And that’s it!

21 Comments

  1. Hi there
    Thanks for this, got my logo up and dispalying!

  2. Won't this detract from a site's SEO? I'd prefer to be more creative with my header than the default text, but I don't want to discourage my page rank either.

  3. Ohh… that's what the -9999px text-indent is about, sliding the text out of view? And Google's not wise to that technique?

  4. How would I insert a header that is an iframe. It is linked to my search site.

    Here is the target for the iframe:

    http://www.uberrealty.com/main.mvc/embeddedsearch

    Code is:

    <iframe width="100%" height="100" frameborder="0" scrolling="no" src="http://www.uberrealty.com/main.mvc/embeddedsearch&gt;
    </iframe>

  5. Just at the end of the page?

    Jim

  6. Perfect. Thank you!

  7. Thank you Bill. Your designs are really great and inspiring. And Thank you for sharing some really great thesis techniques.

  8. Internet Explorer likey this code, Firefox and Safari not likey… Cross browser compatible code available? :)

    • Bill Erickson says:

      This code works in every browser I’ve tested it in, including Firefox and Safari.

      • To redefine and clarify, yes it works – that is logo is clickable – but the clickable dimensions in Firefox and Safari have been reduced to the size and area of the header text only, not the dimensions of the logo, which oftentimes is larger if containing a tagline as part of the overall logo image file. Thanks for the quick reply earlier.

        • Bill Erickson says:

          By making the height and width of .custom #logo a the same as the image, you will make the clickable area the size of the logo image file.

  9. My humble apologies good sir, on reinvestigation of my css .custom #logo a , I had inadvertently sourced my custom #logo code elsewhere… and not from your blog. To all those who visit here, the above code on this blog works as stated for all browsers and the entire image is clickable. Save this code and seek no further… haha. Cheers.

  10. Bill -
    Perfect – just what the doctor ordered! This was very helpful. Thanks!

  11. Woohoo!! The best. Works perfectly in every browser. Thank you SO MUCH for sharing your knowledge!!!

  12. Worked like a charm the first time! (I cannot code without breaking something.) Thank you!

  13. Thanks for the tutorial. Made for an easy fix. I haven’t done this on very many sites since I started using Thesis because I usually just text-indent: -9999px; and forget about display: block; which makes the link work.

    I miss the old days when everything was hand coded but I guess Thesis is about as close to manual control as you can get, especially for being built on WP.

    Btw, I’ve never really thought about it but someone mentioned it above: will this affect any onpage SEO I’ve got going? I’d hate to screw something up over a small convenience alteration like this.

    Thanks again,
    Matt

    • Bill Erickson says:

      I’m not an SEO guy so I can’t say for sure, but my guess is that this does not affect SEO. Almost every website uses an image for a logo rather than straight text, and I can’t see why Google would penalize it.

      • Hi Bill

        Thanks for that code, good for the context of WordPress and Thesis. And, no, definitely no problem using this technique with Google. If one wanted one’s text indexed one would use a different technique such as a background graphic with cufoned text on top, or some such, but often one’s logo has to be all graphics because the text is too complex/difficult to render reliably. Google will treat your technique, as you say common, like it treats all graphics – which it is. Liked your bio too.

        Cheers,
        Adam Ring