<?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; Styling</title>
	<atom:link href="http://wpguru.co.za/category/styling/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>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>29</slash:comments>
		</item>
		<item>
		<title>Using custom fields to create archive thumbnails</title>
		<link>http://wpguru.co.za/styling/using-custom-fields-to-create-archive-thumbnails/</link>
		<comments>http://wpguru.co.za/styling/using-custom-fields-to-create-archive-thumbnails/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 10:33:47 +0000</pubDate>
		<dc:creator>MarkB</dc:creator>
				<category><![CDATA[Styling]]></category>
		<category><![CDATA[Advanced]]></category>
		<category><![CDATA[archive]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[custom fields]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[home page]]></category>
		<category><![CDATA[thumbnails]]></category>

		<guid isPermaLink="false">http://wpguru.co.za/?p=41</guid>
		<description><![CDATA[When I launched this site, I was instantly jumped on by Ruark asking me how I achieved the thumbnails on the home &#038; archive pages of this site. This can be done in a number of simple ways and with a bit of imagination, you can take it to a much greater level. So use this article to understand the basics and then you can decide how best to implement these methods.]]></description>
			<content:encoded><![CDATA[<p><img class="size-medium wp-image-142" title="Thumbnail" src="http://wpguru.co.za/wp-content/uploads/thumbnail-300x300.jpg" alt="Image by &lt;a href=" width=" mce_href=" height="300" />When I launched this site, I was instantly jumped on by <a href="http://www.mahspace.co.za/" target="_blank">Ruark</a> asking me how I achieved the thumbnails on the home &amp; archive pages of this site. This can be done in a number of simple ways and with a bit of imagination, you can take it to a much greater level. So use this article to understand the basics and then you can decide how best to implement these methods.</p>
<h3>You&#8217;ll need&#8230;</h3>
<p>Achieving this thumbnail effect requires a custom field, some CSS, and ideally a screen capturing program. The custom field will capture the URL of the thumbnail image, the CSS will be used to define the exact space the thumbnail will occupy and the screen capturing program will grab the thumbnail itself.</p>
<h3>1) Make the thumbnail</h3>
<p>Personally, I absolutely love <a href="http://www.faststone.org/FSCaptureDetail.htm" target="_blank">FastStone Capture</a>. The full version will cost you all of $19.95 but I promise you its a purchase that&#8217;ll save you bucket loads of time. With it, you can select a marquee area of your screen and it&#8217;ll automatically save that selection as a JPG/GIF/PNG image. Of course you can use the normal print-screen feature, crop it in PhotoShop and then save it, but FastStone will do all that for you.</p>
<h3>2) Upload it</h3>
<p>So once you have your thumbnail image, upload it into WP. In 2.5, the &#8216;Add Media&#8217; feature will upload the image and then present you with the URL to that image.</p>
<p><a href="http://wpguru.co.za/wp-content/uploads/thumburl.gif"><img class="alignnone size-full wp-image-42" title="thumburl" src="http://wpguru.co.za/wp-content/uploads/thumburl.gif" alt="" width="500" height="93" /></a></p>
<p>Copy the URL and then close the upload dialog. Dont insert the image or anything.</p>
<h3>3) Save your custom field</h3>
<p>Then create a new custom field called &#8216;thumb&#8217; (or whatever you like) and copy the URL of that thumbnail image as the value of that key.</p>
<p>At this point, you can save your WP post and open up your code editor of choice&#8230;</p>
<h3>4) Add the code</h3>
<p>Open your index.php or archive.php file, find the loop and insert something like this before <code>the_content()</code> is called:</p>
<pre class="brush: php; title: ; notranslate">&lt;div&gt;&lt;img src=&quot;&lt;? echo get_post_meta($post-&gt;ID, 'thumb', true) ?&gt;&quot; /&gt;&lt;/div&gt;</pre>
<p>The wrapping div around that image is there so we can CSS the thumbnail as necessary.</p>
<p>Note that you can also make the image a link to your article like this:</p>
<pre class="brush: php; title: ; notranslate">&lt;div&gt;&lt;a href= &quot;&lt;? the_permalink(); ?&gt;&quot; title=&quot;&lt;? the_title(); ?&gt;&quot;&gt;&lt;img src=&quot;&lt;? echo get_post_meta($post-&gt;ID, 'thumb', true) ?&gt;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</pre>
<p>This makes simple use of the loop variables to insert the article URL and <code>title</code> tag of the link.</p>
<h3>5) CSS it as necessary</h3>
<p>Lets say that you&#8217;d like your image to be exactly 100px X 100px at all times and you&#8217;d like to float it left so the text wraps up around it to the right. Your CSS would then look like this:</p>
<pre class="brush: css; title: ; notranslate">.thumb {
 width:100px;
 height:100px;
 border:5px solid #efefef;
 float:left;
}</pre>
<p>NOTE: naturally you&#8217;d want the image that you capture to be more than 100&#215;100 so that there&#8217;s no whitespace in that div&#8230;</p>
<h3>6) Enjoy</h3>
<p>And thats that&#8230; Hopefully that explains it adequately Ruark?</p>
<p>Of course you can tailor where in your loop the thumbnail will display and how large etc it is with your CSS.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpguru.co.za/styling/using-custom-fields-to-create-archive-thumbnails/feed/</wfw:commentRss>
		<slash:comments>21</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>

