<?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>Digging into WordPress &#187; title</title>
	<atom:link href="http://digwp.com/tag/title/feed/" rel="self" type="application/rss+xml" />
	<link>http://digwp.com</link>
	<description>Take your WordPress skills to the next level.</description>
	<lastBuildDate>Fri, 18 May 2012 18:21:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Custom Page Titles from Scratch</title>
		<link>http://digwp.com/2010/04/custom-page-titles/</link>
		<comments>http://digwp.com/2010/04/custom-page-titles/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 18:33:20 +0000</pubDate>
		<dc:creator>Chris Coyier</dc:creator>
				<category><![CDATA[SEO]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[title]]></category>

		<guid isPermaLink="false">http://digwp.com/?p=1953</guid>
		<description><![CDATA[The titles of pages are controlled by the &#60;title> tag in the &#60;head> section of a website. They are important for all kinds of reasons. Telling the user where they are. The name of the page when bookmarked both locally and socially. They are important for SEO. So how do we typically handle page titles [...]]]></description>
			<content:encoded><![CDATA[<p>The titles of pages are controlled by the &lt;title> tag in the &lt;head> section of a website. They are important for all kinds of reasons. Telling the user where they are. The name of the page when bookmarked both locally and socially. They are important for SEO.  </p>
<p>So how do we typically handle page titles in WordPress? Hopefully we are A) Using a theme that uses <a href="http://digwp.com/2009/06/custom-wordpress-title-tags/">a pretty smart default page titling system</a> or B) using a plugin that helps us with this same task automatically, as most SEO plugins at least attempt.</p>
<p>The problem with A is that it doesn&#8217;t afford any way to individually override any particular page with a special title. With B, it depends on which plugin you use, but not all of them allow for <em>full</em> control over the <em>entire</em> title, often just the slug that fits into the overall chosen method.</p>
<p><img src="http://digwp.com/wp-content/blog-images/bendtomywill.jpg" width="549" height="268" alt="" title="" /></p>
<p>Finally fed up with both of these techniques, I rolled my own!</p>
<p><span id="more-1953"></span></p>
<h3>Step 1: Remove &lt;title></h3>
<p>Whatever you have for the &lt;title> tag in the header.php file, just get rid of it.</p>
<p><img src="http://digwp.com/wp-content/blog-images/removetitle.png" width="590" height="248" alt="" title="" /></p>
<p>We&#8217;ll be inserting that automatically in the wp_head(); function, so that needs to be there.</p>
<h3>Step 2: New stuff for functions.php file</h3>
<p>We&#8217;re doing three things here.</p>
<ol>
<li>Add a new input box to the admin pages for creating and editing new Posts/Pages</li>
<li>Save the the value of that input box when that Post/Page is saved</li>
<li>Echo out a new title as part of the wp_head() function</li>
</ol>
<pre><code>// Custom Page Titles
add_action('admin_menu', 'custom_title');
add_action('save_post', 'save_custom_title');
add_action('wp_head','insert_custom_title');
function custom_title() {
	add_meta_box('custom_title', 'Change page title', 'custom_title_input_function', 'post', 'normal', 'high');
	add_meta_box('custom_title', 'Change page title', 'custom_title_input_function', 'page', 'normal', 'high');
}
function custom_title_input_function() {
	global $post;
	echo '&lt;input type="hidden" name="custom_title_input_hidden" id="custom_title_input_hidden" value="'.wp_create_nonce('custom-title-nonce').'" /&gt;';
	echo '&lt;input type="text" name="custom_title_input" id="custom_title_input" style="width:100%;" value="'.get_post_meta($post-&gt;ID,'_custom_title',true).'" /&gt;';
}
function save_custom_title($post_id) {
	if (!wp_verify_nonce($_POST['custom_title_input_hidden'], 'custom-title-nonce')) return $post_id;
	if (defined('DOING_AUTOSAVE') &amp;&amp; DOING_AUTOSAVE) return $post_id;
	$customTitle = $_POST['custom_title_input'];
	update_post_meta($post_id, '_custom_title', $customTitle);
}
function insert_custom_title() {
	if (have_posts()) : the_post();
	  $customTitle = get_post_meta(get_the_ID(), '_custom_title', true);
	  if ($customTitle) {
		echo "&lt;title&gt;$customTitle&lt;/title&gt;";
      } else {
    	echo "&lt;title&gt;";
	      if (is_tag()) {
	         single_tag_title("Tag Archive for &amp;quot;"); echo '&amp;quot; - '; }
	      elseif (is_archive()) {
	         wp_title(''); echo ' Archive - '; }
	      elseif ((is_single()) || (is_page()) &amp;&amp; (!(is_front_page())) ) {
	         wp_title(''); echo ' - '; }
	      if (is_home()) {
	         bloginfo('name'); echo ' - '; bloginfo('description'); }
	      else {
	          bloginfo('name'); }
	      if ($paged&gt;1) {
	         echo ' - page '. $paged; }
        echo "&lt;/title&gt;";
    }
    else :
      echo "&lt;title&gt;Page Not Found | Envision&lt;/title&gt;";
	endif;
	rewind_posts();
}</code></pre>
<p>The new input box we are putting on the page saves its value as a custom field on the Post/Page you are on. The key of that custom field is &#8220;_custom_title&#8221;, so it doesn&#8217;t show in the regular custom field list (custom fields that start with underscores don&#8217;t).</p>
<p>Now when any front-end page of the site loads, it checks that page to see if that custom field exists. If it does exist, it uses that value exactly for the page title. If it doesn&#8217;t, it defaults to a generically smart page title structure.</p>
<h3>Result</h3>
<p>This is the box that now is available when creating or editing a Page/Post:</p>
<p><img src="http://digwp.com/wp-content/blog-images/custompagetitle.png" width="590" height="194" alt="" title="" /></p>
<p>And that is what will be used:</p>
<p><img src="http://digwp.com/wp-content/blog-images/customtitleexerted.jpg" width="520" height="200" alt="" title="" /></p>
<hr />
<p><small>© 2010 <a href="http://digwp.com">Digging into WordPress</a> | <a href="http://digwp.com/2010/04/custom-page-titles/">Permalink</a> | <a href="http://digwp.com/2010/04/custom-page-titles/#comments">21 comments</a> | Add to <a href="http://del.icio.us/post?url=http://digwp.com/2010/04/custom-page-titles/&title=Custom Page Titles from Scratch">del.icio.us</a> | Post tags: <a href="http://digwp.com/tag/functions/" rel="tag">functions</a>, <a href="http://digwp.com/tag/title/" rel="tag">title</a><br/></small></p>]]></content:encoded>
			<wfw:commentRss>http://digwp.com/2010/04/custom-page-titles/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>wpSEO vs. All-In-One SEO Pack</title>
		<link>http://digwp.com/2010/04/wpseo-vs-all-in-one/</link>
		<comments>http://digwp.com/2010/04/wpseo-vs-all-in-one/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 15:58:12 +0000</pubDate>
		<dc:creator>Chris Coyier</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[meta]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[title]]></category>

		<guid isPermaLink="false">http://digwp.com/?p=1628</guid>
		<description><![CDATA[The most popular SEO plugin for WordPress is certainly the All-In-One SEO Pack. It&#8217;s on just about every plugin roundup you&#8217;ll ever see. It&#8217;s free. It works well. But it&#8217;s not the only kid on the block. One of the guys from WP Engineer has a competing product: wpSEO. I&#8217;ve now used them both. I [...]]]></description>
			<content:encoded><![CDATA[<p>The most popular SEO plugin for WordPress is certainly the <a href="http://wordpress.org/extend/plugins/all-in-one-seo-pack/">All-In-One SEO Pack</a>. It&#8217;s on just about every plugin roundup you&#8217;ll ever see. It&#8217;s free. It works well. But it&#8217;s not the only kid on the block. One of the guys from <a href="http://wpengineer.com/">WP Engineer</a> has a competing product: <a href="http://wpseo.go2jump.org/SHE">wpSEO</a>. I&#8217;ve now used them both. I thought a head-to-head comparison would be useful for people to see.</p>
<p><span id="more-1628"></span></p>
<p>Let me note that this isn&#8217;t an absolutely comprehensive comparison of every single feature. For example, they both claim to be fast. I&#8217;m not techy enough to know which one is really &#8220;faster&#8221;. These are the features that are important to me.</p>
<table id="comparison">
<tr>
<th>&nbsp;</th>
<th>
All-In-One SEO Pack
</th>
<th>
wpSEO
</th>
<th>Notes</th>
</tr>
<tr>
<td class="feature">Is there a free version?</td>
<td>Yes</td>
<td>No, 10 day trial</td>
<td>I think if you like the wpSEO feature set, you should go for it right away. Configuring your SEO one way and then ditching all that 10 days later seems counter-productive to me.</td>
</tr>
<tr>
<td class="feature">Paid version?</td>
<td>$69.99<br />
(sometimes on sale)</td>
<td>$24.99<br />
(one site)<br />
$64.99<br />
(unlimited)<br />
$124.99<br />
(professional)</td>
<td>The paid version of All-In-One SEO just removes the donation links at the top of the plugin settings. The wpSEO only has a paid version.</td>
</tr>
<tr>
<td class="feature">Support</td>
<td>Various monthly plans, starting at $10/month</td>
<td>Included with paid plugin</td>
<td>If you need support, wpSEO is cheaper as it&#8217;s just included with the plugin price. I can&#8217;t vouch for either as I&#8217;ve never needed support. I gotta imagine support for both of these is unbearable. WHY AIN:T i #1 on da GOOGLe?!?!</td>
</tr>
<tr>
<td class="feature">Meta descriptions</td>
<td>Auto-create and controllable</td>
<td>Auto-create and controllable</td>
<td>This is the most valuable thing to be for both plugins. Meta descriptions are important for SEO and for quality link displays on SERPs. Both plugins will auto-generate these for you, or allow you to override them on a per-post/per-page basis.</td>
</tr>
<tr>
<td class="feature">Meta keywords</td>
<td>Auto-create and controllable</td>
<td>Auto-create and controllable</td>
<td>Keywords are far less important than descriptions, but using them doesn&#8217;t hurt. All-In-One allows you set your own or can use the posts tags and/or categories for them. wpSEO won&#8217;t automatically use tags or categories, but will intelligently use &lt;strong> and &lt;em> tags in your text content or mark them with specific short tags. I also like how you can turn off the keyword override on individual posts with wpSEO (less cruft to look at if you know you don&#8217;t use it).</td>
</tr>
<tr>
<td class="feature">Title Control</td>
<td>Sort of</td>
<td>Full</td>
<td>Title control is just as important as Meta descriptions. All-In-One SEO defaults to the best possible (in my opinion) format which is [Post Title] | [Site Title] and is totally configurable for different types of pages. What you can&#8217;t do is <strong>completely</strong> override a post title, which you can do with wpSEO. Both plugins are pretty equal in ability here.</td>
</tr>
<td class="feature">Canonical tags</td>
<td>Yes</td>
<td>Yes</td>
<td>Canonical tags tell search engines which URL the content on this page &#8220;really&#8221; belongs to. For example, if you have paginated comments, you might have several different URLs which display the same content, which can lead to duplicate content penalties. Both plugins take care of this for you.</td>
</tr>
</table>
<h3>Other little features</h3>
<ul>
<li>You can disable All-In-One SEO without deactivating or uninstalling it.</li>
<li>You can export and import settings with wpSEO. So if you have a specific setup you like to use, it&#8217;s easy to move that to other sites.</li>
</ul>
<h3>General thoughts</h3>
<ul>
<li>wpSEO definitely has more features, but of course more isn&#8217;t always better. The settings page may be overwhelming for some.</li>
<li>All-In-One SEO is free, and it does all the things I consider vital for a SEO plugin.</li>
<li>On a pure features / functions / UI standpoint, I like wpSEO better.</li>
</ul>
<hr />
<p><small>© 2010 <a href="http://digwp.com">Digging into WordPress</a> | <a href="http://digwp.com/2010/04/wpseo-vs-all-in-one/">Permalink</a> | <a href="http://digwp.com/2010/04/wpseo-vs-all-in-one/#comments">24 comments</a> | Add to <a href="http://del.icio.us/post?url=http://digwp.com/2010/04/wpseo-vs-all-in-one/&title=wpSEO vs. All-In-One SEO Pack">del.icio.us</a> | Post tags: <a href="http://digwp.com/tag/meta/" rel="tag">meta</a>, <a href="http://digwp.com/tag/seo/" rel="tag">SEO</a>, <a href="http://digwp.com/tag/title/" rel="tag">title</a><br/></small></p>]]></content:encoded>
			<wfw:commentRss>http://digwp.com/2010/04/wpseo-vs-all-in-one/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>Custom Fields for HTML Post Titles</title>
		<link>http://digwp.com/2009/10/custom-fields-for-html-post-titles/</link>
		<comments>http://digwp.com/2009/10/custom-fields-for-html-post-titles/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 16:28:46 +0000</pubDate>
		<dc:creator>Chris Coyier</dc:creator>
				<category><![CDATA[Theme]]></category>
		<category><![CDATA[custom-fields]]></category>
		<category><![CDATA[title]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://digwp.com/?p=833</guid>
		<description><![CDATA[You don&#8217;t want to go putting HTML tags directly into post titles. It might show up OK on your own site, but it can be problematic. For example, your titles through RSS will show the tags as next, not render them. I was wishing for a plugin to handle this better, but until then, here [...]]]></description>
			<content:encoded><![CDATA[<p>You don&#8217;t want to go putting HTML tags directly into post titles. It might show up OK on your own site, but it can be problematic. For example, your titles through RSS will show the tags as next, not render them. I was wishing for a plugin to handle this better, but until then, here is almost-as-simple way to go about it.</p>
<p><span id="more-833"></span></p>
<h3>1. Enter title without HTML</h3>
<p><img src="http://digwp.com/wp-content/blog-images/normal-title.png" width="590" height="130" alt="" title="" /></p>
<h3>2. Create a custom field for the title <em>with</em> HTML</h3>
<p><img src="http://digwp.com/wp-content/blog-images/html-title-custom-field.png" width="585" height="84" alt="" title="" /></p>
<h3>3. Output custom field on pages you want the HTML</h3>
<p>For example, on the single.php page where you would have used </p>
<pre><code>&lt;h1&gt;&lt;php the_title(); ?&gt;&lt;/h1&gt;</code></pre>
<p>Now you use</p>
<pre><code>&lt;?php

   $html_title = get_post_meta($post-&gt;ID, "HTML_title", true);

   if ($html_title) { ?&gt;
                
      &lt;h1&gt;&lt;?php echo $html_title; ?&gt;&lt;/h1&gt;
                
   &lt;?php } else { ?&gt;
                
      &lt;h1&gt;&lt;?php the_title(); ?&gt;&lt;/h1&gt;
                    
&lt;?php } ?&gt;</code></pre>
<p>This checks and sees if that custom field is set. If it is, it outputs that. If not, it uses the regular function.</p>
<p>Because the RSS templates use the regular the_title() function, your titles are same from being weirdified in feed readers.</p>
<h3>Example</h3>
<p>The example used here was from <a href="http://chriscoyier.net/2009/10/26/grooveshark-on-the-iphone/">my new blog layout</a>, where I&#8217;m trying to have as much control as possible for doing interesting post layouts.</p>
<hr />
<p><small>© 2009 <a href="http://digwp.com">Digging into WordPress</a> | <a href="http://digwp.com/2009/10/custom-fields-for-html-post-titles/">Permalink</a> | <a href="http://digwp.com/2009/10/custom-fields-for-html-post-titles/#comments">15 comments</a> | Add to <a href="http://del.icio.us/post?url=http://digwp.com/2009/10/custom-fields-for-html-post-titles/&title=Custom Fields for HTML Post Titles">del.icio.us</a> | Post tags: <a href="http://digwp.com/tag/custom-fields/" rel="tag">custom-fields</a>, <a href="http://digwp.com/tag/title/" rel="tag">title</a>, <a href="http://digwp.com/tag/tricks/" rel="tag">tricks</a><br/></small></p>]]></content:encoded>
			<wfw:commentRss>http://digwp.com/2009/10/custom-fields-for-html-post-titles/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Plugin Wishes Come True</title>
		<link>http://digwp.com/2009/10/plugin-wishes-come-true/</link>
		<comments>http://digwp.com/2009/10/plugin-wishes-come-true/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 00:05:47 +0000</pubDate>
		<dc:creator>Chris Coyier</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[title]]></category>

		<guid isPermaLink="false">http://digwp.com/?p=821</guid>
		<description><![CDATA[Just a quick update to the post I wrote about plugins I&#8217;m too lazy to write. Steve Whiteley put together a plugin for Subtitles that is exactly how I envisioned it. For my wishes about avoiding widows in post titles, Shaun Inman had the solution years ago. (Shaun&#8217;s site is down for me right now, [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick update to the post I wrote about <a href="http://digwp.com/2009/10/ideas-for-plugins/">plugins I&#8217;m too lazy to write</a>. <a href="http://twitter.com/36flavours">Steve Whiteley</a> put together <a href="http://wordpress.org/extend/plugins/subheading/screenshots/">a plugin for Subtitles</a> that is exactly how I envisioned it. For my wishes about avoiding widows in post titles, <a href="http://twitter.com/shaunInman">Shaun Inman</a> had the solution <a href="http://shauninman.com/archive/2008/08/25/widont_2_1_1">years ago</a>. (Shaun&#8217;s site is down for me right now, but I&#8217;m sure won&#8217;t be for long).</p>
<p>The one I was really hoping to see is the &#8220;plugin notes&#8221; (add a text field to each plugin on manage plugins page to add notes as to why it&#8217;s being used) idea, but no bites yet.</p>
<hr />
<p><small>© 2009 <a href="http://digwp.com">Digging into WordPress</a> | <a href="http://digwp.com/2009/10/plugin-wishes-come-true/">Permalink</a> | <a href="http://digwp.com/2009/10/plugin-wishes-come-true/#comments">8 comments</a> | Add to <a href="http://del.icio.us/post?url=http://digwp.com/2009/10/plugin-wishes-come-true/&title=Plugin Wishes Come True">del.icio.us</a> | Post tags: <a href="http://digwp.com/tag/title/" rel="tag">title</a><br/></small></p>]]></content:encoded>
			<wfw:commentRss>http://digwp.com/2009/10/plugin-wishes-come-true/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Ideas for Plugins I&#8217;m Too Lazy To Write</title>
		<link>http://digwp.com/2009/10/ideas-for-plugins/</link>
		<comments>http://digwp.com/2009/10/ideas-for-plugins/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 14:36:53 +0000</pubDate>
		<dc:creator>Chris Coyier</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[title]]></category>

		<guid isPermaLink="false">http://digwp.com/?p=629</guid>
		<description><![CDATA[&#8230; or slightly more accurately, that I don&#8217;t know how to write =) Subtitle I think it would be a cool format for a blog to have a title and a subtitle for every single Post. You could easily do it with Custom Fields, but this plugin would alter the Admin screen for writing posts [...]]]></description>
			<content:encoded><![CDATA[<p>&#8230; or slightly more accurately, that I don&#8217;t know how to write =)</p>
<h3>Subtitle</h3>
<p>I think it would be a cool format for a blog to have a title <strong>and</strong> a subtitle for every single Post. You could easily do it with Custom Fields, but this plugin would alter the Admin screen for writing posts to insert an additional text area underneath the title and above the content area. </p>
<p><img src="http://digwp.com/wp-content/blog-images/subtitle.png" width="590" height="268" alt="" title="" /></p>
<p>Then there would be a special function for displaying the subtitle like:</p>
<pre><code>&lt;?php the_subtitle(); ?&gt;</code></pre>
<p><span id="more-629"></span></p>
<p>&nbsp;</p>
<h3>Rich Text Titles</h3>
<p>Speaking of titles, it would be cool if we were able to use HTML tags in titles sometimes. For example, just being able to add &lt;em&gt; tags to a word in the title would be cool, but that causes problems currently. It might display OK on your site, but it may cause validation problems (since the tags will show up inside title attributes and such) and may come across screwed up in feed readers. This plugin would alter the the_title() function to automatically strip the HTML tags, but create a new function like the_title_html() that would retain the tags for display anywhere you want to make sure they persist. This would ensure the RSS feed remains unscathed.</p>
<p><img src="http://digwp.com/wp-content/blog-images/html-title.png" width="590" height="116" alt="" title="" /></p>
<p>&nbsp;</p>
<h3>Plugin Notes</h3>
<p>Ever look through your list of plugins and forget just exactly what one of them does? I know they have descriptions next to them, but that doesn&#8217;t always speak to <strong>exactly what <em>you</em> are using it for</strong> and why. This plugin would just put a text field in each plugin field you could type some notes in there, theoretically to keep information about why and how you are using this plugin.</p>
<p><img src="http://digwp.com/wp-content/blog-images/plugin-notes.png" width="590" height="402" alt="" title="" /></p>
<p>You&#8217;d probably have to also add buttons/links for adding &#038; removing notes.</p>
<p>&nbsp;</p>
<h3>Notify All Admins</h3>
<p>On this blog we have two admins: me and Jeff. When I write and publish a post, and someone comments, I get an email about it (but Jeff doesn&#8217;t). When Jeff writes and publishes a post, and someone comments, he gets an email about it (but I don&#8217;t). Since this is both of our sites, I wouldn&#8217;t mind getting ALL comment notifications. But I&#8217;m not sure if Jeff feels the same way. So this plugin would just add an extra user option (only active for full site admins):</p>
<p><img src="http://digwp.com/wp-content/blog-images/comment-notification.png" width="590" height="223" alt="" title="" /></p>
<p>&nbsp;</p>
<h3>Title Un-Widower</h3>
<p>There is a pretty robust plugin called <a href="http://wordpress.org/extend/plugins/wp-typography/">WP-Typography</a> that covers widows in post titles. I give it props, but my personal preference is to handle 90% of what it does on my own. What I can&#8217;t do on my own is add non-breaking spaces to the last two words in a post title (one of the things it does). I currently <a href="http://css-tricks.com/preventing-widows-in-post-titles/">do this with jQuery</a> on some sites which is OK, but would be better done with PHP so it happens <strong>before</strong> the page renders no matter what.</p>
<p><img src="http://digwp.com/wp-content/blog-images/post-un-widower.png" width="523" height="200" alt="" title="" /></p>
<p>&nbsp;</p>
<p>So if there are already plugins out there that do this stuff, I apologize. I admit I didn&#8217;t launch a giant manhunt to find existing plugins that did these things.</p>
<hr />
<p><small>© 2009 <a href="http://digwp.com">Digging into WordPress</a> | <a href="http://digwp.com/2009/10/ideas-for-plugins/">Permalink</a> | <a href="http://digwp.com/2009/10/ideas-for-plugins/#comments">27 comments</a> | Add to <a href="http://del.icio.us/post?url=http://digwp.com/2009/10/ideas-for-plugins/&title=Ideas for Plugins I&#8217;m Too Lazy To Write">del.icio.us</a> | Post tags: <a href="http://digwp.com/tag/hacking/" rel="tag">hacking</a>, <a href="http://digwp.com/tag/plugin/" rel="tag">plugin</a>, <a href="http://digwp.com/tag/title/" rel="tag">title</a><br/></small></p>]]></content:encoded>
			<wfw:commentRss>http://digwp.com/2009/10/ideas-for-plugins/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Custom WordPress Title Tags</title>
		<link>http://digwp.com/2009/06/custom-wordpress-title-tags/</link>
		<comments>http://digwp.com/2009/06/custom-wordpress-title-tags/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 23:03:33 +0000</pubDate>
		<dc:creator>Jeff Starr</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[header]]></category>
		<category><![CDATA[tags]]></category>
		<category><![CDATA[title]]></category>

		<guid isPermaLink="false">http://modernwordpress.com/?p=22</guid>
		<description><![CDATA[By default, WordPress provides a decent way of including &#60;title&#62; information for your posts, pages, and various archive views. Using WordPress&#8217; built-in template tag, &#8220;wp_title()&#8221;, we can specify several useful parameters, including: sep &#8211; a string value indicating the separator displayed before the title echo &#8211; a boolean value determining whether or not the title [...]]]></description>
			<content:encoded><![CDATA[<p>By default, WordPress provides a decent way of including <code>&lt;title&gt;</code> information for your posts, pages, and various archive views. Using WordPress&rsquo; built-in template tag, &ldquo;<code>wp_title()</code>&rdquo;, we can specify several useful parameters, including:</p>
<ul>
<li><code>sep</code> &ndash; a string value indicating the separator displayed before the title</li>
<li><code>echo</code> &ndash; a boolean value determining whether or not the title is displayed</li>
<li><code>seplocation</code> &ndash; specifies the position of sep string, either left or right of the title</li>
</ul>
<p>Here is the basic format for this tag:</p>
<pre><code>&lt;?php wp_title('sep', 'echo', 'seplocation'); ?&gt;</code></pre>
<p>..which is typically combined with the <code>bloginfo('name')</code> tag and used in the <code>header.php</code> file as follows:</p>
<pre><code>&lt;head&gt;
&lt;title&gt;&lt;?php wp_title(' | ', 'echo', 'right'); ?&gt;&lt;?php bloginfo('name'); ?&gt;
&lt;/head&gt;</code></pre>
<p><span id="more-22"></span></p>
<p>This would produce the following output for each of the following page types:</p>
<ul>
<li>The Home page &ndash; outputs the name of the site</li>
<li>Individual pages &ndash; page title | name of site</li>
<li>Single post views &ndash; post title | name of site</li>
<li>Archived post views &ndash; outputs the name of the site</li>
<li>Date-based archives &ndash; year and/or month | name of site</li>
<li>Category archives &ndash; category title | name of site</li>
<li>Author archives &ndash; public username | name of site</li>
<li>404 error pages &ndash; outputs the name of the site</li>
<li>Search results &ndash; outputs the name of the site</li>
<li>Tag archives &ndash; tag name | name of site</li>
</ul>
<p>For the average blog, this works fine; most pages include the title as well as the blog name, while those without specific page names simply output the name of the site instead. To go above and beyond, however, a little more preparation is needed. For example, rather than output only the blog name for search and tag pages, why not specify the exact tag or search term being displayed? And what about archive pages? We can customize those as well using the following code:</p>
<pre><code>&lt;title&gt;
&lt;?php
if (is_category()) {
	echo 'Category: '; wp_title(''); echo ' - ';

} elseif (function_exists('is_tag') &amp;&amp; is_tag()) {
	single_tag_title('Tag Archive for &amp;quot;'); echo '&amp;quot; - ';

} elseif (is_archive()) {
	wp_title(''); echo ' Archive - ';

} elseif (is_page()) {
	echo wp_title(''); echo ' - ';

} elseif (is_search()) {
	echo 'Search for &amp;quot;'.wp_specialchars($s).'&amp;quot; - ';

} elseif (!(is_404()) &amp;&amp; (is_single()) || (is_page())) {
	wp_title(''); echo ' - ';

} elseif (is_404()) {
	echo 'Not Found - ';

} bloginfo('name');
?&gt;
&lt;/title&gt;</code></pre>
<p>When used in place of the default WordPress <code>wp_title()</code> tag, this code will produce clear, informative page titles for tag, search, date, author and other archive views, as well as for the dreaded 404 page. Further, this code may be modified to elaborate the various page titles however you wish, and also may be enhanced further, as explained in our book, <a href="http://digwp.com/preorder/" title="Digging into WordPress">Digging into WordPress</a>.</p>
<hr />
<p><small>© 2009 <a href="http://digwp.com">Digging into WordPress</a> | <a href="http://digwp.com/2009/06/custom-wordpress-title-tags/">Permalink</a> | <a href="http://digwp.com/2009/06/custom-wordpress-title-tags/#comments">3 comments</a> | Add to <a href="http://del.icio.us/post?url=http://digwp.com/2009/06/custom-wordpress-title-tags/&title=Custom WordPress Title Tags">del.icio.us</a> | Post tags: <a href="http://digwp.com/tag/header/" rel="tag">header</a>, <a href="http://digwp.com/tag/tags/" rel="tag">tags</a>, <a href="http://digwp.com/tag/title/" rel="tag">title</a><br/></small></p>]]></content:encoded>
			<wfw:commentRss>http://digwp.com/2009/06/custom-wordpress-title-tags/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

