<?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; SEO</title>
	<atom:link href="http://justintadlock.com/tags/seo/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>Using WordPress Custom Fields: Subtitles</title>
		<link>http://justintadlock.com/archives/2007/10/16/using-wordpress-custom-fields-subtitles</link>
		<comments>http://justintadlock.com/archives/2007/10/16/using-wordpress-custom-fields-subtitles#comments</comments>
		<pubDate>Tue, 16 Oct 2007 18:55:33 +0000</pubDate>
		<dc:creator>Justin Tadlock</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Custom Fields]]></category>
		<category><![CDATA[SEO]]></category>

		<guid isPermaLink="false">http://justintadlock.com/archives/2007/10/16/using-wordpress-custom-fields</guid>
		<description><![CDATA[This article, or series of articles, is long overdue. I&#8217;ve been using custom fields to make &#8220;little&#8221; fixes around this site for a while now. They are probably the most powerful feature of WordPress, yet the least used. Maybe that&#8217;s because they&#8217;re hidden away at the bottom of the &#8220;Write&#8221; page. I want to share [...]]]></description>
			<content:encoded><![CDATA[<p>This article, or series of articles, is long overdue.  I&#8217;ve been using custom fields to make &#8220;little&#8221; fixes around this site for a while now.  They are probably the most powerful feature of WordPress, yet the least used.  Maybe that&#8217;s because they&#8217;re hidden away at the bottom of the &#8220;Write&#8221; page.  I want to share some of the things I&#8217;ve learned with you.  Maybe I&#8217;ll even learn a thing or two while doing it.</p>
<p>This is the first post in what I hope to be an ongoing series of how to use <a href="http://codex.wordpress.org/Using_Custom_Fields" title="WordPress: Using Custom Fields"> WordPress&#8217; custom fields</a>.  The inspiration for finally getting my butt in gear and writing the first post was Nick La&#8217;s post, <a href="http://www.webdesignerwall.com/tutorials/wordpress-theme-hacks" title="WordPress Theme Hacks"> WordPress Theme Hacks</a>.</p>
<p>This post will serve as a quick tutorial on a simple use of custom fields.  I will later get more in depth with the &#8220;why&#8221; and &#8220;how&#8221; of using these things.  So, to get your feet a little wet&#8230;</p>
<p>Today, I will show a simple solution to fixing your title tags (those words at the top of your Web browser when you visit a site).  This will also help a little in optimizing your site for SEO.  Basically, we&#8217;re going to create a subtitle to each post or page we create.  This subtitle will be displayed with the title at the top of the browser.</p>
<p>The first thing you need to do is open &#8220;header.php.&#8221;  Simple enough, right?  Find:</p>
<pre><code>&lt;title&gt;
&lt;/title&gt;</code></pre>
<p>We will only be working between the title tags today.</p>
<p>Nick gives us a nice starting point in fixing your title tags.  Here is the code:</p>
<pre><code>&lt;?php
if (is_home()) {
	echo bloginfo('name');
} elseif (is_404()) {
	echo '404 Not Found';
} elseif (is_category()) {
	echo 'Category:'; wp_title('');
} elseif (is_search()) {
	echo 'Search Results';
} elseif (is_day() || is_month() || is_year() ) {
	echo 'Archives:'; wp_title('');
} elseif (is_tag()) {
	echo 'Tag:'; wp_title('');
} else {
	echo wp_title('');
}
?&gt;</code></pre>
<p>Obviously, you can play around with this a little and do what you like with it.  Now, we will figure out how to optimize for SEO by inputting extra information with custom fields.</p>
<p>Save your copy of &#8220;header.php.&#8221;  Open your WordPress dashboard and go to &#8220;Write Post&#8221; or &#8220;Write Page.&#8221;  After writing your post, scroll down to the box labeled &#8220;Custom Fields.&#8221;  Add a new &#8220;Key&#8221; named &#8220;subtitle.&#8221;  Write your subtitle in the &#8220;Value&#8221; box.</p>
<p><a href='http://justintadlock.com/blog/wp-content/uploads/2007/10/custom-fields-subtitle.gif' title='How to input a subtitle into the custom field box for use with the title tag'><img class='center i400x150' src='http://justintadlock.com/blog/wp-content/uploads/2007/10/cf-subtitle-thumb.gif' alt='How to input a subtitle into the custom field box for use with the title tag' /></a></p>
<p>Now, you are almost ready to see your efforts in all their beauty.  Open &#8220;header.php&#8221; again (it should still be open).  Below the last <code> echo wp_title('');</code> add the following code on the next line.</p>
<pre><code>$subtitle = get_post_meta
($post->ID, 'subtitle', $single = true);
if($subtitle !== '') echo ': ' . $subtitle;</code></pre>
<p>This code pulls your custom field key of &#8220;subtitle&#8221; out and displays it on whatever pages have a subtitle.  Your final code should look like this:</p>
<pre><code>&lt;?php
if (is_home()) {
	echo bloginfo('name');
} elseif (is_404()) {
	echo '404 Not Found';
} elseif (is_category()) {
	echo 'Category:'; wp_title('');
} elseif (is_search()) {
	echo 'Search Results';
} elseif (is_day() || is_month() || is_year() ) {
	echo 'Archives:'; wp_title('');
} elseif (is_tag()) {
	echo 'Tag:'; wp_title('');
} else {
	echo wp_title('');
	$subtitle = get_post_meta
	($post->ID, 'subtitle', $single = true);
	if($subtitle !== '') echo ': ' . $subtitle;
}
?&gt;</code></pre>
<p>Yes, simple, yet useful.  You don&#8217;t need a plugin for this task.  You can see how I&#8217;m putting it to use on this page.  The title is &#8220;Using WordPress Custom Fields,&#8221; and the subtitle is &#8220;A series of tutorials on WordPress&#8217; most powerful feature.&#8221;</p>
<p>I hope you continue to follow this series, as I hope to continue to learn and develop.  <a href="http://feeds.feedburner.com/justintadlock" title="Subcribe to Justin Tadlock"> Subscribe to my feed</a> to keep updated or bookmark this page because I&#8217;ll provide a link here to the next tutorial.  In the next article, I will talk more about what custom fields are and why we need to use them.</p>
<p>Do you have any ideas on what would make a useful function using custom fields, but you&#8217;re just not sure how to implement it?</p>
]]></content:encoded>
			<wfw:commentRss>http://justintadlock.com/archives/2007/10/16/using-wordpress-custom-fields-subtitles/feed</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
	</channel>
</rss>

