<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Justin Tadlock &#187; Tutorials</title>
	<atom:link href="http://justintadlock.com/tags/tutorials/feed" rel="self" type="application/rss+xml" />
	<link>http://justintadlock.com</link>
	<description>Life, Blogging, and WordPress</description>
	<lastBuildDate>Mon, 06 Feb 2012 18:39:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>WordPress Custom Fields: Book Reviews Pt. 2</title>
		<link>http://justintadlock.com/archives/2007/11/20/wordpress-custom-fields-book-reviews-pt-2</link>
		<comments>http://justintadlock.com/archives/2007/11/20/wordpress-custom-fields-book-reviews-pt-2#comments</comments>
		<pubDate>Tue, 20 Nov 2007 21:59:36 +0000</pubDate>
		<dc:creator>Justin Tadlock</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Custom Fields]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://justintadlock.com/archives/2007/11/20/wordpress-custom-fields-book-reviews-pt-2</guid>
		<description><![CDATA[This part of the tutorial will cover making things look a little prettier. It is a more advanced PHP tutorial than any of the previous tutorials in the overall custom fields series. Basically, we will do a lot of work, but it won&#8217;t look like we&#8217;ve accomplished much. We still have to get much of [...]]]></description>
			<content:encoded><![CDATA[<p>This part of the <a href="/attachment/716" title="Using WordPress custom fields to create a reviews site"> tutorial</a> will cover making things look a little prettier.  It is a more advanced PHP tutorial than any of the previous tutorials in the overall custom fields series.  Basically, we will do a lot of work, but it won&#8217;t look like we&#8217;ve accomplished much.  We still have to get much of the basic code out of the way first.</p>
<p>By the end of this part of the tutorial, you may be wondering why in the hell you would go through all this trouble to display a linked image correctly and a few other things when you could&#8217;ve just as quickly typed all this in the post box.  And, you are right to think this.  Here are some reasons why this way can be useful:</p>
<ul>
<li>You can change the look of all your reviews and their custom fields without having to edit each post.</li>
<li>You can pull these custom fields out to use them in other areas of the site, like a reviews page.</li>
<li>You can display these things with your excerpts in your archives, categories, and search results.</li>
<li>There really is no limit to what you can do with WordPress custom fields.</li>
</ul>
<p>Although some of the &#8220;cooler&#8221; things are yet to come, we have to get the basics out of the way first.</p>
<h3>Adding a rating system:</h3>
<p>Now, that you&#8217;ve played around with the first part of the tutorial and you&#8217;re ready to move on, there is one thing I would like you to add to the original part of the code.  <a href="http://donalyza.com" title="Donalyza"> Donalyza</a> asked how she could add a rating system to her music reviews.</p>
<p>To add a rating system, the first thing you should do is create a <strong> Key</strong> named <strong> Rating</strong>.  Then, give it a <strong> Value</strong> of <strong> your rating</strong>.  For this tutorial, I&#8217;ll use a 1 &#8211; 5 rating system, but you can easily change this to 1 &#8211; 10, ABC, etc.</p>
<p>Open your file from the previous tutorial (home.php or single.php) and find the first code we entered:</p>
<pre><code>&lt;?php
// The book image
$image = get_post_meta($post-&gt;ID, 'Image', $single = true);

// The image alt text
$image_alt = get_post_meta($post-&gt;ID, 'Image Alt', $single = true);

// Image class (used for alignment, sizing, or styling using CSS)
$image_class = get_post_meta($post-&gt;ID, 'Image Class', $single = true);

// Book Author
$author = get_post_meta($post-&gt;ID, 'Author', $single = true);

// Outside link for book
$book_link = get_post_meta($post-&gt;ID, 'Book Link', $single = true);

// Title of the book
$book_title = get_post_meta($post-&gt;ID, 'Book Title', $single = true);

// Recommend? Yes or No
$recommend = get_post_meta($post-&gt;ID, 'Recommend', $single = true);

// Published date of book
$published_date = get_post_meta($post-&gt;ID, 'Published Date', $single = true);
?&gt;</code></pre>
<p>Add this after the &#8220;published&#8221; part, but before the <code> ?&gt;</code>:</p>
<pre><code>// Book Rating
$rating = get_post_meta($post->ID, 'Rating', $single = true);</code></pre>
<p>At the end of this post, I&#8217;ll show you how to display your ratings.</p>
<h3>The more complicated stuff:</h3>
<p>I&#8217;ll walk you through displaying your image, creating a link around that image, and a few other things in this part of the tutorial.  These are techniques that we&#8217;ll use later on.  So, it&#8217;s best to learn them now.</p>
<p>Find these lines from the previous part of the tutorial and delete them.  We&#8217;ll use these things, but in a more creative way.</p>
<pre><code>// If there's an image
if($image !== '') {
	echo '&lt;p&gt;&lt;strong&gt;Image URL:&lt;/strong&gt; ' . $image . '&lt;/p&gt;';
	}

// If there's image alt text
if($image_alt !== '') {
	echo '&lt;p&gt;&lt;strong&gt;Image Alt:&lt;/strong&gt; ' . $image_alt . '&lt;/p&gt;';
	}

// If there's an image CSS class
if($image_class !== '') {
	echo '&lt;p&gt;&lt;strong&gt;Image Class:&lt;/strong&gt; ' . $image_class . '&lt;/p&gt;';
	}

// If there's a book link
if($book_link !== '') {
	echo '&lt;p&gt;&lt;strong&gt;Book Link:&lt;/strong&gt; ' . $book_link . '&lt;/p&gt;';
	}</code></pre>
<p>Everything from this point forward relies heavily on you having an image to display with your review.  This is vital to this tutorial and the code you are about to see.  What we&#8217;re doing is checking to see if there&#8217;s an image and displaying it.  We will add alt text, a link, link title text, and an image class.  We&#8217;re interweaving all these elements together.  I ran through displaying the text on screen in the previous tutorial, so you could get a feel for how things work.</p>
<p>Replace the code you deleted with this (this should be above the line that reads <strong> // If there&#8217;s a book title</strong>):</p>
<pre><code>// If there's an image
if($image !== '') {
	echo '&lt;p&gt;';
	// If there's a book link
	if($book_link !== '') {
		echo '&lt;a href="' . $book_link . '" title="';
			// If there's image alt text
			if($image_alt !== '') echo $image_alt;
			else echo the_title();
		echo '"&gt;';
		} // end if

	// Show the image
	echo '&lt;img src="' . $image . '"';
		// If there's an image class
		if($image_class !== '') echo 'class="' . $image_class . '"';
	echo 'alt="';
		// If there's image alt text
		if($image_alt !== '') echo $image_alt;
		else echo the_title();
	echo '" /&gt;';

	// If there's a book link, close it off
	if($book_link !== '') {
		echo '&lt;/a&gt;';
		} //end if
	echo '&lt;/p&gt;';
	}</code></pre>
<p>Yes, the code just got crazy all of a sudden.  I urge you to take the time to read through this thoroughly to understand how the PHP works.  It&#8217;s not really complicated, but it can be overwhelming for newcomers to look at.  Feel free to ask questions on anything that&#8217;s going on in that part of the code.  I tried to leave plenty of comments to help you along.</p>
<h3>Customizing the recommendation area:</h3>
<p>In this part of the custom fields tutorial, we&#8217;ll add an image to the &#8220;Recommend&#8221; section.  You might also notice that the code is a little different from the previous tutorial, but it has now been updated.  This was a slight mistake I made, and you should make sure you update it.</p>
<p>Scroll down to the recommendation part of your code, which looks like this:</p>
<pre><code>// If there's a recommendation
if($recommend == 'yes' || $recommend == 'Yes') {
	echo '&lt;p&gt;&lt;strong&gt;Recommend?&lt;/strong&gt; ' . $recommend . '&lt;/p&gt;';
	}
elseif($recommend == 'no' || $recommend == 'No') {
	echo '&lt;p&gt;&lt;strong&gt;Recommend?&lt;/strong&gt; ' . $recommend . '&lt;/p&gt;';
	}
else { echo ''; }
?&gt;</code></pre>
<p>Replace it with this code:</p>
<pre><code>// If there's a recommendation
if($recommend == 'yes' || $recommend == 'Yes') {
	echo '&lt;p&gt;&lt;strong&gt;Recommend?&lt;/strong&gt; &lt;img src="/path/to/your/image/recommend-yes.gif" alt="I recommend this book!" /&gt;&lt;/p&gt;';
	}
elseif($recommend == 'no' || $recommend == 'No') {
	echo '&lt;p&gt;&lt;strong&gt;Recommend?&lt;/strong&gt; &lt;img src="/path/to/your/image/recommend-no.gif" alt="Only touch this book if your life depends on it!" /&gt;&lt;/p&gt;';
	}
else { echo ''; }</code></pre>
<p>You&#8217;ll need to upload an image for your &#8220;Yes&#8221; and &#8220;No&#8221; recommendations.  You&#8217;ll also need to change the path to the image in the above code.</p>
<h3>Displaying your ratings:</h3>
<p>Now that you&#8217;ve given your book, album, movie, game, or whatever a rating, you&#8217;ll want to display it.  Instead of the common if/else statement, we&#8217;ll use a PHP switch statement to execute this (this works even better if you have a 1 &#8211; 10 rating system.</p>
<p>Below the last code we added for the recommendations, add this code:</p>
<pre><code>// If there's a rating
if($rating !== '') {
	echo '&lt;p&gt;&lt;strong&gt;Rating: &lt;/strong&gt;';
	switch ($rating) {
	// If the rating is 0
	case 0:
		echo $rating;
		break;
	// If the rating is 1
	case 1:
		echo $rating;
		break;
	// If the rating is 2
	case 2:
		echo $rating;
		break;
	// If the rating is 3
	case 3:
		echo $rating;
		break;
	// If the rating is 4
	case 4:
		echo $rating;
		break;
	// If the rating is 5
	case 5:
		echo $rating;
		break;
	// Else
	default:
		echo 'No rating.';
		break;
		}
	echo '&lt;/p&gt;';
	}</code></pre>
<p>Looks pretty generic huh?  Not a lot of pizazz?  That&#8217;s OK.  You can use the same image technique we used above for book recommendations.  Instead of <code> echo $rating;</code>, you can echo an image.  You&#8217;ll need to create different images for each rating.</p>
<h3>The CSS:</h3>
<p>I won&#8217;t bother with a lot of CSS in this tutorial, but I do want to share one thing.  For the custom field <strong> Key</strong> that&#8217;s named <strong> Image Class</strong>, I&#8217;ve given it a value of <strong> left</strong>.  In my &#8220;style.css&#8221; file, I float this image to the left so that the following text will wrap around it.  Here&#8217;s the code I use:</p>
<pre><code>.left {
	float: left;
	margin: 0 10px 5px 0;
	}</code></pre>
<h3>What does it look like?</h3>
<p>Here&#8217;s an image of what my review looks like:</p>
<p><img src="http://justintadlock.com/wp-content/uploads/2007/11/book-reviews-2.gif" alt="Using WordPress custom fields to create a review management system that works" class="center i400x300" /></p>
<h3>The end of part 2 of the tutorial:</h3>
<p>You can arrange each element how you like.  You can put all the review information after the post content, before the post content, before the image, or wherever.  Do what you like.  This is the time when you should tinker with how you want your reviews to look on the screen.  Add CSS classes to things to style them how you want.  Add extra custom fields for other useful bits of information that you&#8217;d like to add.</p>
<p>In the next part of the tutorial, I&#8217;ll cover what I call the &#8220;cool&#8221; stuff.  I&#8217;ll show you how you can use these custom fields outside of home.php and single.php to create a more unique blog.</p>
<p>If you&#8217;ve noticed any errors in the code, please be sure to let me know.  <a href="http://feeds.feedburner.com/justintadlock" title="Subscribe to the feed"> Subscribe to the feed</a> to know when the next part of the tutorial rolls around.  Feel free to ask any questions and/or suggest anything you&#8217;d like to see added to the tutorial.</p>
]]></content:encoded>
			<wfw:commentRss>http://justintadlock.com/archives/2007/11/20/wordpress-custom-fields-book-reviews-pt-2/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>WordPress Custom Fields: Book Reviews Pt. 1</title>
		<link>http://justintadlock.com/archives/2007/11/15/wordpress-custom-fields-book-reviews-pt-1</link>
		<comments>http://justintadlock.com/archives/2007/11/15/wordpress-custom-fields-book-reviews-pt-1#comments</comments>
		<pubDate>Thu, 15 Nov 2007 22:51:06 +0000</pubDate>
		<dc:creator>Justin Tadlock</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Custom Fields]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://justintadlock.com/archives/2007/11/15/wordpress-custom-fields-book-reviews-pt-1</guid>
		<description><![CDATA[Finally, another part in the WordPress custom fields tutorial series. This time, weâ€™re stepping it up a notch though. Weâ€™re going to take custom fields to another level. I hope youâ€™re prepared. Weâ€™ve covered some basic things thus far, and thatâ€™s all you need to know to be prepared. Have you ever wanted to write [...]]]></description>
			<content:encoded><![CDATA[<p>Finally, another part in the <a href="/attachment/678" title="WordPress Custom Field Series"> WordPress custom fields tutorial series</a>. This time, weâ€™re stepping it up a notch though. Weâ€™re going to take custom fields to another level. I hope youâ€™re prepared. Weâ€™ve covered some basic things thus far, and thatâ€™s all you need to know to be prepared.</p>
<p>Have you ever wanted to write book, movie, music, or other type of review and archive them effectively, add extra information, and make reviewing them a little cooler? In this part of the series, Iâ€™ll cover many ways to accomplish this, while leaving you with many options to add your own twist to it. Iâ€™m using book reviews as an example, but you can easily change this to any type of review.</p>
<p>This is actually a series within a series. There will be several parts to the using custom fields to create book reviews entry into the overall series.</p>
<p>Now, thatâ€™s enough of an introduction. Letâ€™s get on with putting this thing together.</p>
<p>Today, weâ€™ll set up the code that weâ€™ll be using later. This is a little bit of a refresher course on the basics of custom fields.</p>
<h3>The setup:</h3>
<p>The first thing you need to do is create a new post. Iâ€™m going to review the book <em> I, Robot</em> by Isaac Asimov. You can find the particular version Iâ€™m using at its <a href="http://www.amazon.com/gp/product/0553803700" title="I, Robot by Isaac Asimov"> Amazon page</a>. Choose anything youâ€™d like. Now, add a new category to this post named â€œBook Reviews.â€</p>
<p>Write your review, add your tags, and whatever else you might normally do for your posts. Now, weâ€™ll create our custom fields.</p>
<h3>The custom fields:</h3>
<p>Weâ€™ll use several different custom fields for this tutorial, but you can add as many as youâ€™d like to customize your reviews. The custom field <strong> Keys</strong> that weâ€™ll create are these: Author, Book Title, Image, Image Alt, Image Class, Book Link, Published Date, and Recommend. (Remember that custom field <strong> Keys</strong> are case-sensitive.)</p>
<p>This is what your setup should look like:</p>
<ul>
<li><strong><strong> Key</strong>:</strong> Value</li>
<li><strong>Author:</strong> Author of the book</li>
<li><strong>Book Title:</strong> Title of the book</li>
<li><strong>Image:</strong> URL of an image of the book</li>
<li><strong>Image Alt:</strong> Alt text for the image</li>
<li><strong>Image Class:</strong> Use a class for personal styling of image</li>
<li><strong>Book Link:</strong> Link to an outside source for the book (maybe an Amazon page)</li>
<li><strong>Published Date:</strong> Date the book was published</li>
<li><strong>Recommend:</strong> Write Yes or No on whether you recommend this book</li>
</ul>
<p>Hereâ€™s an image of what my custom field setup looks like:</p>
<p><a href="http://justintadlock.com/wp-content/uploads/2007/11/books.gif" title="Book Reviews: Using WordPress Custom Fields"><img class="center i400x150" src="http://justintadlock.com/wp-content/uploads/2007/11/books-small.gif" alt="Using WordPress custom fields to create book reviews" /></a></p>
<p>So, you should upload an image of your book to follow this tutorial. Now, our review is written and our custom fields are ready.</p>
<h3>The code:</h3>
<p>Today, weâ€™re only going to pull the custom fields from the database and make sure everything is working correctly. Thereâ€™ll be no styling or anything super-cool, but weâ€™ll get the basics out of the way. Open index.php (you should also use this code in single.php).</p>
<p>Under this code:</p>
<pre><code>&lt;?php while(have_posts()) : the_post(); ?&gt;</code></pre>
<p>Add this:</p>
<pre><code>&lt;?php
// The book image
$image = get_post_meta($post-&gt;ID, 'Image', $single = true);

// The image alt text
$image_alt = get_post_meta($post-&gt;ID, 'Image Alt', $single = true);

// Image class (used for alignment, sizing, or styling using CSS)
$image_class = get_post_meta($post-&gt;ID, 'Image Class', $single = true);

// Book Author
$author = get_post_meta($post-&gt;ID, 'Author', $single = true);

// Outside link for book
$book_link = get_post_meta($post-&gt;ID, 'Book Link', $single = true);

// Title of the book
$book_title = get_post_meta($post-&gt;ID, 'Book Title', $single = true);

// Recommend? Yes or No
$recommend = get_post_meta($post-&gt;ID, 'Recommend', $single = true);

// Published date of book
$published_date = get_post_meta($post-&gt;ID, 'Published Date', $single = true);
?&gt;</code></pre>
<p>Basically, what this does is pull each custom field from the database and set it to a PHP variable. This is important because weâ€™ll use the variable a lot in the future, and we want to keep the code as easy to manage as possible. The shorter variable names makes this possible.</p>
<p>Now, above this code:</p>
<pre><code>&lt;?php the_content(); ?&gt;</code></pre>
<p>Add this:</p>
<pre><code>&lt;?php
// If there's an image
if($image !== '') {
	echo '&lt;p&gt;&lt;strong&gt;Image URL:&lt;/strong&gt; ' . $image . '&lt;/p&gt;';
	}

// If there's image alt text
if($image_alt !== '') {
	echo '&lt;p&gt;&lt;strong&gt;Image Alt:&lt;/strong&gt; ' . $image_alt . '&lt;/p&gt;';
	}

// If there's an image CSS class
if($image_class !== '') {
	echo '&lt;p&gt;&lt;strong&gt;Image Class:&lt;/strong&gt; ' . $image_class . '&lt;/p&gt;';
	}

// If there's a book title
if($book_title !== '') {
	echo '&lt;p&gt;&lt;strong&gt;Title:&lt;/strong&gt; ' . $book_title . '&lt;/p&gt;';
	}

// If there's a book link
if($book_link !== '') {
	echo '&lt;p&gt;&lt;strong&gt;Book Link:&lt;/strong&gt; ' . $book_link . '&lt;/p&gt;';
	}

// If there's a published date
if($published_date !== '') {
	echo '&lt;p&gt;&lt;strong&gt;Published:&lt;/strong&gt; ' . $published_date . '&lt;/p&gt;';
	}

// If there's an author
if($author !== '') {
	echo '&lt;p&gt;&lt;strong&gt;Author:&lt;/strong&gt; ' . $author . '&lt;/p&gt;';
	}

// If there's a recommendation
if($recommend == 'yes' || $recommend == 'Yes') {
	echo '&lt;p&gt;&lt;strong&gt;Recommend?&lt;/strong&gt; ' . $recommend . '&lt;/p&gt;';
	}
elseif($recommend == 'no' || $recommend == 'No') {
	echo '&lt;p&gt;&lt;strong&gt;Recommend?&lt;/strong&gt; ' . $recommend . '&lt;/p&gt;';
	}
else { echo ''; }
?&gt;</code></pre>
<p>This will give you a list of the various custom fields that youâ€™ve created. I hope you can understand a little bit about whatâ€™s happening behind the scenes here by looking at the a text display of your custom fields.</p>
<p>Hereâ€™s what the output on my page looks like:</p>
<p><img src="http://justintadlock.com/wp-content/uploads/2007/11/books-2.gif" alt="View of the outputted page by using WordPress custom fields to create book reviews" class="center i400x300" /></p>
<p>Thatâ€™s the end of this part of the tutorial. I want you to start thinking about what other <strong> Keys</strong> you might want to add. Do you want to add a rating system? Hardback and/or paperback release dates? Links to other outside sources? There are limitless options here.</p>
<p>Some other things Iâ€™ll cover are putting this all together, creating pretty archives, a page for all your book reviews, and other various uses.</p>
<p>Please share your thoughts and <a href="http://feeds.feedburner.com/justintadlock" title="Subscribe to the feed"> subscribe to the feed</a> to know when the next part of the tutorial comes out.</p>
]]></content:encoded>
			<wfw:commentRss>http://justintadlock.com/archives/2007/11/15/wordpress-custom-fields-book-reviews-pt-1/feed</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Valid XHTML Clickable Header Images</title>
		<link>http://justintadlock.com/archives/2007/10/22/valid-xhtml-clickable-header-images</link>
		<comments>http://justintadlock.com/archives/2007/10/22/valid-xhtml-clickable-header-images#comments</comments>
		<pubDate>Mon, 22 Oct 2007 15:09:29 +0000</pubDate>
		<dc:creator>Justin Tadlock</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://justintadlock.com/archives/2007/10/22/valid-xhtml-clickable-header-images</guid>
		<description><![CDATA[This is a tutorial on how to make your blog or website header image clickable with valid XHTML. This is assuming that you&#8217;re using a CSS background image for your header or that you want to. I was recently designing a theme that I wanted to add a clickable header image to, but had forgotten [...]]]></description>
			<content:encoded><![CDATA[<p><img class="center" src="http://justintadlock.com/wp-content/uploads/2007/10/clickable-header.gif" alt="Valid XHTML clickable header images" title="Valid XHTML clickable header images" /></p>
<p>This is a tutorial on how to make your blog or website header image clickable with valid XHTML.  This is assuming that you&#8217;re using a CSS background image for your header or that you want to.</p>
<p>I was recently designing a theme that I wanted to add a clickable header image to, but had forgotten the best way to accomplish this task.  So, I quickly searched Google and thought I found an easy way to do this with the <a href="http://codex.wordpress.org/Designing_Headers#Making_the_Whole_Header_Clickable" title="WordPress Codex: Making the whole header clickable"> WordPress clickable header tutorial</a>, but quickly realized that it wasn&#8217;t valid XHTML.  Many other tutorials showed this same example as well.</p>
<p>Basically, they were wrapping the <code> &lt;a&gt;</code> element around the <code> &lt;h1&gt;</code> element.  This is bad.  Very bad.  CSS can do so much.  Why ruin its beauty with poorly structured HTML?</p>
<p>After playing around with the CSS for a while, I came up with a solution.</p>
<p>First, you obviously need a header image.  For the sake of this tutorial, the width and height of this image will be 350px by 90px.  You can change the values in the CSS to match with your header image.  Add this code to your header file or wherever your header image will go.</p>
<h3>XHTML</h3>
<pre><code>&lt;div id="header"&gt;
&lt;h1&gt;
&lt;a href="/index.php" title="Blog Title"&gt;&lt;span>Blog Title&lt;/span&gt;&lt;/a&gt;
&lt;/h1&gt;
&lt;/div&gt;</code></pre>
<p>Now, we need to style this thing.</p>
<h3>CSS</h3>
<pre><code>#header {
	float: left;
	width: 100%;
	}
#header h1 {
	float: left;
	margin: 0;
	padding: 0;
	width: 350px;
	}
#header h1 a {
	padding: 0;
	margin: 0;
	width: 350px;
	height: 90px;
	display: block;
	background: url(images/header1.gif) no-repeat top left;
	}
#header h1 a span { display: none; }</code></pre>
<p>These CSS values aren&#8217;t going to be exact all the time.  Some things can change depending on your layout.  Your positioning, height, width, margin, and padding are all variables that may need to change.  The most important things are these lines:</p>
<pre><code>#header h1 a {
	width: 350px;
	height: 90px;
	display: block;
	background: url(images/header1.gif) no-repeat top left;
	}</code></pre>
<p>Giving the link (which has a background image) a width, height, block display, and adding the image are the things you must do.</p>
<p>That should pretty much do it.  If you have any problems, please let me know through the <a href="http://justintadlock.com/forums" title="Support forums"> support forums</a>.  Otherwise, enjoy using your valid XHTML clickable header image.</p>
<p>You can also use this technique to make any element clickable with a background image, not just header images.</p>
]]></content:encoded>
			<wfw:commentRss>http://justintadlock.com/archives/2007/10/22/valid-xhtml-clickable-header-images/feed</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
	</channel>
</rss>

