Whitespace WordPress Theme and Title Image Replacement
With a new title font selected I created the graphic I needed in Photoshop as a gif:
But how to use in the theme? I like the idea of image replacement – where you have the title specified as text – great for search engines and for people who surf without images on, but I have never used the technique. Here is how I got things sorted here – i don’t claim any of its optimal, but it seems to work well enough I think.
MezzoBlue has a page called Revised Image Replacement and it goes through a number of ways of doing it. Based on that I went for the Gilder/Levin solution….
1. Put the new graphic in your wp-content/themes/whitespace/images directory using ftp
2 In WordPress Admin you need to edit style.css. Go into Presentation/Theme Editor and click on Stylesheet. Scroll down and in the header section find:
#headerleft {
width: 465px;
height: 90px;
float: left;
margin: 0px;
padding: 20px 0px 0px 0px;
}
Change this to
#headerleft {width: 465px;
height: 90px;
float: left;
margin: 0px;
padding: 20px 0px 0px 0px;
position: relative;
}
#headerleft span {
background: url(images/brucemarriottcom_logo.gif) no-repeat;
background-position: -3px 24px;
position: absolute;
top: 0px; left: 0px;
width: 100%;
height: 100%;
}
There is one new line in #headerleft – the position: relative; This is really important and without it I was seeing most of the pages wrecked and one big link. For an explanation of why the position relative is needed see this discussion on DigitalPoint.
Also a brand new #headerleft span definition is added in. The background-position: -3px 24px; will probably be different for you – its what I need to make my new title graphic end up in just the right place.
With the changes done click the Update File button
3) In WordPress Admin you need to edit the Header. Go into Presentation/Theme Editor and click on Header.
Search for
<div id=”headerleft”>
<a href=”<?php echo get_settings(‘home’); ?>/”><?php bloginfo(‘name’); ?></a><br />
<?php bloginfo(‘description’); ?>
</div>
and change to:
<div id=”headerleft”>
<a href=”<?php echo get_settings(‘home’); ?>/”><span></span><?php bloginfo(‘name’); ?></a><br />
<?php bloginfo(‘description’); ?>
</div>
With the changes done click the Update File button
4) Now go look at your weblog and you should see the new title replace the old text. Just tweak background position coordinates until it sits where you want.
Browser Checks
I tried this on Firefox 2, IE7 and Safari 3 on a PC and it works fine. However on IE7 the hot link curser does not show up when you role over the graphic (it does on Firefox and Safari), however clicking on the graphic has the desired effect and all browsers take you back to the Home page. Those 3 browsers are good enough for me. However for an exhaustive look at these techniques across all try this piece at Ryznardesign. I have to say though that its really above me in its exhaustive detail.