<?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>The WordPress Guru &#187; Header</title>
	<atom:link href="http://wpguru.co.za/category/header/feed/" rel="self" type="application/rss+xml" />
	<link>http://wpguru.co.za</link>
	<description>Tips &#38; Pointers on Making a Killer CMS with WordPress</description>
	<lastBuildDate>Mon, 01 Aug 2011 10:26:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Creating a dynamic page or post title</title>
		<link>http://wpguru.co.za/header/creating-a-dynamic-page-or-post-title/</link>
		<comments>http://wpguru.co.za/header/creating-a-dynamic-page-or-post-title/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 12:49:14 +0000</pubDate>
		<dc:creator>MarkB</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Header]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[title]]></category>

		<guid isPermaLink="false">http://wpguru.co.za/?p=109</guid>
		<description><![CDATA[If you're not a fan of using a WordPress SEO plugin to manage your page title's etc, then there's a very good way to do this yourself by using WordPress Conditional Tags.]]></description>
			<content:encoded><![CDATA[<div id="attachment_110" class="wp-caption alignright" style="width: 310px"><img class="size-medium wp-image-110" title="pagetitle" src="http://wpguru.co.za/wp-content/uploads/pagetitle-300x135.jpg" alt="" width="300" height="135" /><p class="wp-caption-text">Image Courtesy Michelle  Chance-Sangthon</p></div>
<p>If you&#8217;re not a fan of using a WordPress SEO plugin to manage your page title&#8217;s etc, then there&#8217;s a very good way to do this yourself by using <a href="http://codex.wordpress.org/Conditional_Tags">WordPress Conditional Tags</a>.</p>
<p>Essentially what you&#8217;re doing is adding an if/else statement that caters for your different template types.  Your standard title tag might look something like this:</p>
<pre class="brush: php; title: ; notranslate">&lt;? bloginfo('name'); ?&gt; | &lt;? bloginfo('description'); ?&gt;</pre>
<p>This would make the title of your webpage be the title of your site, followed by a pipe &#8220;|&#8221; and then the description of your site (as entered in your WordPress settings). However the problem with this is that your other pages are then not optimized using that page or posts title. What you want to do then, is make conditional statements that give a unique title on each page. This is the code you&#8217;re going to use:</p>
<pre class="brush: php; title: ; notranslate">&lt;title&gt;
 &lt;? if ( is_home() ) { ?&gt;&lt;?php bloginfo('name'); ?&gt; | &lt;?php bloginfo('description'); ?&gt;&lt;?php } ?&gt;
 &lt;? if ( is_search() ) { ?&gt;Search Results | &lt;?php bloginfo('name'); ?&gt;&lt;?php } ?&gt;
 &lt;? if ( is_author() ) { global $wp_query; $curauth = $wp_query-&gt;get_queried_object(); ?&gt;Author Archives | &lt;?php echo $curauth-&gt;nickname; ?&gt; | &lt;?php bloginfo('name'); ?&gt;&lt;?php } ?&gt;
 &lt;? if ( is_single() ) { ?&gt;&lt;?php wp_title(''); ?&gt; | &lt;?php bloginfo('name'); ?&gt;&lt;?php } ?&gt;
 &lt;? if ( is_page() ) { ?&gt;&lt;?php wp_title(''); ?&gt; | &lt;?php bloginfo('name'); ?&gt;&lt;?php } ?&gt;
 &lt;? if ( is_category() ) { ?&gt;&lt;?php single_cat_title(); ?&gt; | Archive | &lt;?php bloginfo('name'); ?&gt;&lt;?php } ?&gt;
 &lt;? if ( is_year() ) { ?&gt;&lt;?php the_time('Y'); ?&gt; | Archive | &lt;?php bloginfo('name'); ?&gt;&lt;?php } ?&gt;
 &lt;? if ( is_month() ) { ?&gt;&lt;?php the_time('F Y'); ?&gt; | Archive | &lt;?php bloginfo('name'); ?&gt;&lt;?php } ?&gt;
 &lt;? if ( is_day() ) { ?&gt;&lt;?php the_time('d F Y'); ?&gt; | Archive | &lt;?php bloginfo('name'); ?&gt;&lt;?php } ?&gt;
 &lt;? if ( is_404() ) { ?&gt;Page not found...&lt;?php } ?&gt;
&lt;? if (function_exists('is_tag')) { if (is_tag()) { ?&gt;&lt;?php single_tag_title(&quot;&quot;, true); ?&gt; | Tag Archive | &lt;?php bloginfo('name'); ?&gt;&lt;?php } } ?&gt;
&lt;/title&gt;</pre>
<p>What you have now is a page title that is setup to display a unique title for each of your main WordPress templates.</p>
<p>Have you tried a different method? Let us know in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpguru.co.za/header/creating-a-dynamic-page-or-post-title/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom header images for WordPress Pages</title>
		<link>http://wpguru.co.za/header/custom-header-images-for-wordpress-pages/</link>
		<comments>http://wpguru.co.za/header/custom-header-images-for-wordpress-pages/#comments</comments>
		<pubDate>Mon, 18 Aug 2008 12:27:53 +0000</pubDate>
		<dc:creator>MarkB</dc:creator>
				<category><![CDATA[Header]]></category>
		<category><![CDATA[Page]]></category>
		<category><![CDATA[Single]]></category>
		<category><![CDATA[Styling]]></category>
		<category><![CDATA[Admin]]></category>
		<category><![CDATA[custom field]]></category>
		<category><![CDATA[custom header]]></category>
		<category><![CDATA[image]]></category>

		<guid isPermaLink="false">http://wpguru.co.za/?p=72</guid>
		<description><![CDATA[I've had a recent request regarding a popular tweak for WordPress - that is, to add custom page header images to any page in WordPress. There are one or two plugins that do this, but with a bit of creativity you can accomplish this very easily using WordPress custom fields and it's built in image uploader. Here's how:]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had a <a href="http://www.jasonbagley.com/">recent request</a> regarding a popular tweak for WordPress &#8211; that is, to add custom page header images to any page in WordPress. There are one or two plugins that do this, but with a bit of creativity you can accomplish this very easily using WordPress custom fields and it&#8217;s built in image uploader. Here&#8217;s how:</p>
<h3>The basics</h3>
<p>You&#8217;re basically going to setup a number of if/else statements in your template where you want your header image to appear. The final statement will be an else statement so that if none of the above rules apply, it&#8217;ll degrade so that you&#8217;ll always have a header image on your page.</p>
<p>You&#8217;re going to create a custom field that has the name of the image that you want to use as a header image. You don&#8217;t have to add the full path to the image. Since you&#8217;re uploading your custom image in the WordPress uploader, it&#8217;ll always end up in the same folder and so the path to the image will be entered in the template.</p>
<h3>The how-to</h3>
<p>So firstly create your image, and upload it to your page.</p>
<p>Then add a custom field called &#8220;header&#8221; and put the name of the file as the value of the field.</p>
<p><img class="aligncenter size-full wp-image-71" title="customfield1" src="http://wpguru.co.za/wp-content/uploads/customfield1.jpg" alt="" width="500" height="194" /></p>
<p>Then open up your template where you want your image to appear and add the following PHP &#8211; tailored to work as you need it to&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>get_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'header'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;img src=&quot;<span style="color: #000000; font-weight: bold;">&lt;?</span> bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/wp-content/uploads/<span style="color: #000000; font-weight: bold;">&lt;?</span> <span style="color: #b1b100;">echo</span> get_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'header'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; alt=&quot;<span style="color: #000000; font-weight: bold;">&lt;?</span> bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;
<span style="color: #000000; font-weight: bold;">&lt;?</span> <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;img src=&quot;<span style="color: #000000; font-weight: bold;">&lt;?</span> bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template_directory'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/images/header.jpg&quot; /&gt;
<span style="color: #000000; font-weight: bold;">&lt;?</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>So what you&#8217;ve now done, is tell the template to check if the custom field &#8220;header&#8221; has a value. If it does, then use that value to display your image. However, if the custom field is empty, then it&#8217;ll degrade to the second default image that you specify.</p>
<p>And presto: you can now use your WP admin to control header images on each page. This is also a good way to do it because now your client can update/add his header images on his own without having to bug you.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpguru.co.za/header/custom-header-images-for-wordpress-pages/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>Simpler code &amp; styling with conditional tags</title>
		<link>http://wpguru.co.za/header/simpler-code-styling-with-conditional-tags/</link>
		<comments>http://wpguru.co.za/header/simpler-code-styling-with-conditional-tags/#comments</comments>
		<pubDate>Fri, 11 Apr 2008 07:06:08 +0000</pubDate>
		<dc:creator>MarkB</dc:creator>
				<category><![CDATA[Header]]></category>
		<category><![CDATA[Styling]]></category>
		<category><![CDATA[body]]></category>
		<category><![CDATA[conditional tags]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://wpguru.co.za/?p=35</guid>
		<description><![CDATA[WordPress provides an awesome way of minimizing the extra coding you might have to do on each template that you create. You'll more than likely have a slightly different way of styling your page.php, single.php and archive.php. Thus on each of those templates you'd have to add a different class or id in order to edit the styling in your CSS. Here's how you can make this a much simpler process...]]></description>
			<content:encoded><![CDATA[<div id="attachment_154" class="wp-caption alignright" style="width: 310px"><img class="size-medium wp-image-154" title="Conditional Tag" src="http://wpguru.co.za/wp-content/uploads/conditional-300x225.jpg" alt="" width="300" height="225" /><p class="wp-caption-text">Image by disownedlight</p></div>
<p>WordPress provides an awesome way of minimizing the extra coding you might have to do on each template that you create. You’ll more than likely have a slightly different way of styling your page.php, single.php and archive.php. Thus on each of those templates you’d have to add a different class or id in order to edit the styling in your CSS. Here’s how you can make this a much simpler process…</p>
<p>Your header.php should include the opening tag. (If it doesn’t you’ll need to add this line of code to each of the files that have your tag)</p>
<p>Basically, this conditional tag says that if the current page is home, then use the following CSS class.</p>
<pre class="brush: php; title: ; notranslate">&lt;? if (is_home()) { ?&gt;class=&quot;homepage&quot;&lt;? } ?&gt;</pre>
<p>If you’re going to have no need to style the single.php and page.php templates differently, then you can tweak the conditional tag to have 2 features like so:</p>
<pre class="brush: php; title: ; notranslate">&lt;? if (is_single() || is_page()) { ?&gt;class=&quot;insidepages&quot;&lt;? } ?&gt;</pre>
<p>Once you know what templates you’re going to be using throughout your site, you can then have a conditional tag in your body that’ll style each page with a different CSS ID or class.</p>
<pre class="brush: php; title: ; notranslate">&lt;body &lt;? if (is_home()) { ?&gt;class=&quot;home&quot;&lt;? } elseif (is_single() || is_page()) { ?&gt;class=&quot;insidepages&quot;&lt;? } elseif (is_archive() || is_search() || is_tag()) { ?&gt;class=&quot;archive&quot;&lt;? } ?&gt;&lt;/body&gt;</pre>
<p>This can of course be applied to any other block level element you’d like. I personally like using the body so that my coding can be as simple and neat as possible.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpguru.co.za/header/simpler-code-styling-with-conditional-tags/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

