<?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>dustincaruso.com &#187; PHP</title>
	<atom:link href="http://dustincaruso.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://dustincaruso.com</link>
	<description>custom web app development</description>
	<lastBuildDate>Mon, 29 Mar 2010 11:44:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>capitalize page titles in WordPress</title>
		<link>http://dustincaruso.com/php/capitalize-page-titles-in-wordpress/</link>
		<comments>http://dustincaruso.com/php/capitalize-page-titles-in-wordpress/#comments</comments>
		<pubDate>Fri, 29 May 2009 21:59:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://dustincaruso.com/?p=183</guid>
		<description><![CDATA[(without using a Plugin) &#160; While working on a custom WordPress theme for a client this morning, I came across a peculiar problem. The words I was using for custom tags and categories which (in this particular theme design) get displayed in the page&#8217;s &#60;title&#62; in breadcrumb-like fashion, were being displayed just as they were [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: 16px;"><i>(without using a Plugin)</i></span></p>
<p>&nbsp;</p>
<p>While working on a custom WordPress theme for a client this morning, I came across a peculiar problem. The words I was using for custom tags and categories which (in this particular theme design) get displayed in the page&#8217;s <code>&lt;title&gt;</code> in breadcrumb-like fashion, were being displayed just as they were typed in &#8211; with all lower-case characters. After doing some Google searching, I discovered there was no documented easy solution to capitalizing these text values. I found that there were many Plugins available that do this, but I really felt like installing a Plugin just to get some words capitalized seemed like overkill. Eventually, by using some of the code I found in those plugins, I hand-rolled the simple solution I was looking for, and thought I&#8217;d share it with y&#8217;all here&#8230;</p>
<p style="margin-bottom: 11px;">First, let me explain that I did not have an issue with getting some things capitalized, like category name, for instance. To do that i simply used the PHP string function, <code>ucwords()</code> inline like so&#8230;</p>
<p><code>&lt;title&gt;Site Name - &lt;?php echo ucwords($category); ?&gt;&lt;/title&gt;</code></p>
<p style="margin-top: 10px; margin-bottom: 11px;">The problem I was having was with the WordPress template tags: <code>wp_title</code> and <code>the_title</code>. You can&#8217;t use <code>ucwords()</code> directly on these because they&#8217;re not a string. So, the solution I came up with was to write a small PHP function at the top of my &#8220;header.php&#8221; file that takes the text values from <code>wp_title</code> and <code>the_title</code>, turns them into a string, and applies capitalization with the <code>ucwords()</code> function&#8230;</p>
<p><code>&lt;?php<br />
function captitle($title) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$title = ucwords($title);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return $title;<br />
}<br />
add_filter('wp_title', 'captitle');<br />
add_filter('the_title', 'captitle');<br />
?&gt;</code></p>
<p>&nbsp;<br />enjoy.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://dustincaruso.com/php/capitalize-page-titles-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
