<?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; Single</title>
	<atom:link href="http://wpguru.co.za/category/single/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>Force a file to download</title>
		<link>http://wpguru.co.za/templates/page/force-a-file-to-download/</link>
		<comments>http://wpguru.co.za/templates/page/force-a-file-to-download/#comments</comments>
		<pubDate>Tue, 04 May 2010 08:42:54 +0000</pubDate>
		<dc:creator>MarkB</dc:creator>
				<category><![CDATA[Advanced]]></category>
		<category><![CDATA[Page]]></category>
		<category><![CDATA[Single]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://wpguru.co.za/?p=168</guid>
		<description><![CDATA[In building CMS sites for clients, some may require that you offer certain files to be downloaded off their site. A PDF for example, or perhaps wallpapers or other media. Most browsers, correctly, will display these items inline as a new page or tab however for these purposes you need to force the browser to [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_169" class="wp-caption alignright" style="width: 310px"><img class="size-medium wp-image-169" title="download" src="http://wpguru.co.za/wp-content/uploads/download-300x199.jpg" alt="" width="300" height="199" /><p class="wp-caption-text">Image by: vizzzual-dot-com</p></div>
<p>In building CMS sites for clients, some may require that you offer certain files to be downloaded off their site. A PDF for example, or perhaps wallpapers or other media. Most browsers, correctly, will display these items inline as a new page or tab however for these purposes you need to force the browser to download the item, not display it. Here&#8217;s how it&#8217;s done.</p>
<h3>The Code</h3>
<p>Your .htaccess file is the key to getting this done, and here&#8217;s the code you need to add:</p>
<pre class="brush: xml; title: ; notranslate">AddType application/octet-stream .csv
AddType application/octet-stream .xls
AddType application/octet-stream .doc
AddType application/octet-stream .avi
AddType application/octet-stream .mpg
AddType application/octet-stream .mov
AddType application/octet-stream .pdf</pre>
<p>You can of course add as many other filetypes to this list as you may require, but you can get the principle from this example.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpguru.co.za/templates/page/force-a-file-to-download/feed/</wfw:commentRss>
		<slash:comments>7</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>Using Different Templates for Posts &amp; Pages</title>
		<link>http://wpguru.co.za/templates/single/using-different-templates-for-posts-pages/</link>
		<comments>http://wpguru.co.za/templates/single/using-different-templates-for-posts-pages/#comments</comments>
		<pubDate>Thu, 12 Jun 2008 13:08:11 +0000</pubDate>
		<dc:creator>MarkB</dc:creator>
				<category><![CDATA[Single]]></category>
		<category><![CDATA[custom fields]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[templatepath]]></category>

		<guid isPermaLink="false">http://wpguru.co.za/?p=62</guid>
		<description><![CDATA[Many times when using a WordPress site to manage static and dynamic content, you'll have need to display posts in very different ways depending on the category they're in. For example, if your site has products in various categories, as well as a blog news category, you'd most likely want to display your product listings and news listings in different ways. Here's how you can do this.]]></description>
			<content:encoded><![CDATA[<p>Many times when using a WordPress site to manage static and dynamic content, you&#8217;ll have need to display posts in very different ways depending on the category they&#8217;re in. For example, if your site has products in various categories, as well as a blog news category, you&#8217;d most likely want to display your product listings and news listings in different ways. Here&#8217;s how you can do this.</p>
<h3>The Template Method</h3>
<p>Whenever WordPress needs to display &#8216;posts&#8217;, it uses the <code>single.php</code> template. What we&#8217;re going to do, is use the <code>single.php</code> file simply to redirect WP to the template it needs to use.</p>
<p>Firstly, remove all the content from your current <code>single.php</code> file and paste it in (for example) &#8216;<code>template-blog.php</code>&#8216;. Then create a second file that you&#8217;ll use as your uniquely styled template, lets say &#8216;<code>template-other.php</code>&#8216;.</p>
<p>Then add the following to your <code>single.php</code> file.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>in_category<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'20'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span>TEMPLATEPATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/template-other.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span>TEMPLATEPATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/template-blog.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>The above code, is pretty simple to understand. You&#8217;re saying that if, the post being viewed is in category &#8217;20&#8242;, then use the template specified, otherwise revert to the other template &#8217;30&#8242;.</p>
<p>Simple!</p>
<p>You can also string multiple of such statements together using the <code>elseif</code> PHP command, like so:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>in_category<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'20'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span>TEMPLATEPATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/template-other.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span>in_category<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'30'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span>TEMPLATEPATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/template-unique.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span>TEMPLATEPATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/template-blog.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>There&#8217;s another method that this can be done.</p>
<h3>The Custom Field Method</h3>
<p>I&#8217;m a big fan of <a href="http://wpguru.co.za/tag/custom-fields/">WordPress custom fields</a> and this is another great method you can use to easily assign templates to specific post categories.</p>
<p>What we&#8217;re going to say, is &#8216;if the custom field &#8216;wide&#8217; exists, then use the specified template, otherwise use the other template. Here&#8217;s how it works:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</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;">'wide'</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: #b1b100;">include</span><span style="color: #009900;">&#40;</span>TEMPLATEPATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/template-other.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span>TEMPLATEPATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/template-blog.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Then when writing/saving your post, all you need to do is add a value of &#8216;yes&#8217; to the template custom field that you&#8217;ll create called &#8216;wide&#8217; and presto, your <code>single.php</code> file will spot the presence of the custom field and use the specified template.</p>
<p>You can of course also use both the above methods within your template if you want to, for example, add or remove certain areas from your page. You can do this by using if/else statements within your template. Like so:</p>
<p>Hopefully, this&#8217;ll give you some more ideas as to how you can further tweak your WP.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpguru.co.za/templates/single/using-different-templates-for-posts-pages/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>More creative uses for custom fields</title>
		<link>http://wpguru.co.za/templates/page/more-creative-uses-for-custom-fields/</link>
		<comments>http://wpguru.co.za/templates/page/more-creative-uses-for-custom-fields/#comments</comments>
		<pubDate>Thu, 10 Apr 2008 10:58:17 +0000</pubDate>
		<dc:creator>MarkB</dc:creator>
				<category><![CDATA[Page]]></category>
		<category><![CDATA[Single]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[custom fields]]></category>

		<guid isPermaLink="false">http://wpguru.co.za/?p=29</guid>
		<description><![CDATA[So your client has a small area of their site that displays their contact numbers. It's one of those small features that most sites have, but its also a feature that you don't want to be bugged with when it changes or when they need something edited. Here's a simple guide to how you can use custom fields for this.]]></description>
			<content:encoded><![CDATA[<p>So your client has a small area of their site that displays their contact numbers. It&#8217;s one of those small features that most sites have, but its also a feature that you don&#8217;t want to be bugged with when it changes or when they need something edited. Here&#8217;s a simple guide to how you can use custom fields for this.</p>
<p>Choose a page on their site that you know will be kept throughout the life of their site &#8211; Perhaps an &#8216;about us&#8217; page. Create custom fields for each of their contact details, maybe:</p>
<ul>
<li>Telephone: 012 345 6789</li>
<li>Fax: 012 345 6789</li>
<li>Email Address: info@site.com</li>
</ul>
<p>Then, use your special query to call the custom field for each of those</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;div id=&quot;contactdetails&quot;&gt;
	&lt;ul&gt;
		&lt;li&gt;Telephone: <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: #cc66cc;">2</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'telephone'</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>&lt;/li&gt;
		&lt;li&gt;Fax: <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: #cc66cc;">2</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'fax'</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>&lt;/li&gt;
		&lt;li&gt;Email: &lt;a href= &quot;mailto:<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: #cc66cc;">2</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'email'</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;&gt;<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: #cc66cc;">2</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'email'</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>&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;
&lt;/div&gt;</pre></div></div>

<p>Note that in this example, &#8217;2&#8242; is the <code>page_id</code> of the about us page. Change this number to whatever the ID is of the page that you use to keep this information.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpguru.co.za/templates/page/more-creative-uses-for-custom-fields/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to make good use of custom fields</title>
		<link>http://wpguru.co.za/templates/page/how-to-make-good-use-of-custom-fields/</link>
		<comments>http://wpguru.co.za/templates/page/how-to-make-good-use-of-custom-fields/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 15:28:57 +0000</pubDate>
		<dc:creator>MarkB</dc:creator>
				<category><![CDATA[Page]]></category>
		<category><![CDATA[Single]]></category>
		<category><![CDATA[custom fields]]></category>
		<category><![CDATA[images]]></category>

		<guid isPermaLink="false">http://wpguru.co.za/?p=14</guid>
		<description><![CDATA[WordPress' custom fields are an often overlooked feature that gives an amazing boost of power to your content management system. Custom fields allow you to take your WordPress installation from a simple post and page management tool, to a full database management system. Here's how...]]></description>
			<content:encoded><![CDATA[<p>WordPress&#8217; custom fields are an often overlooked feature that gives an amazing boost of power to your content management system. Custom fields allow you to take your WordPress installation from a simple post and page management tool, to a full database management system. Here&#8217;s how&#8230;</p>
<h3>What are they?</h3>
<p><a href="http://wpguru.co.za/wp-admin/WordPress' custom fields are an often overlooked feature that gives an amazing boost of power to your content management system. Custom fields allow you to take your WordPress installation from a simple post and page management tool, to a full database management system. Here's how..." target="_blank">Custom fields</a> are essentially extra fields attached to a post. There&#8217;s the <strong>key</strong> which is the &#8216;name&#8217; of your extra field. Then there&#8217;s <strong>value</strong> which is pretty self explanatory &#8211; its the value of the key that you&#8217;ve inserted. You can add any number of values to one specific key, and you can add as many key/value combinations as you like.</p>
<h3>Ways of using Custom Fields</h3>
<p>Lets say that you&#8217;re starting an accommodation listing site, and you have 3 or 4 images for each listing that you&#8217;d like to show.</p>
<ul>
<li>Upload the first image</li>
<li>Enter the key &#8216;images&#8217;</li>
<li>Paste the path to the uploaded image as the value of this key</li>
<li>&#8216;Add Custom Field&#8217;</li>
<li>Repeat as many times as necessary</li>
</ul>
<p>Now you have an array of values assigned to the key &#8216;images&#8217;. Now in your <code>single.php</code> template, you want to show these images. No problems. What you&#8217;re going to do, is create a loop that will repeat for as many images as you&#8217;ve uploaded. Like so:</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: #000088;">$images</span> <span style="color: #339933;">=</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;">&quot;images&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?</span> <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$images</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$image</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;img src=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$image</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> /&gt;&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Alternatively, lets say that you want to have a thumbnail for each entry in your <code>archive.php</code> template. You can combine some crafty CSS with a PHP query to bring in 1 of the images in the &#8216;images&#8217; array and presto!</p>
<p>Here&#8217;s how to display your image:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;div class=&quot;thumb&quot;&gt;
	&lt;a href= &quot;<span style="color: #000000; font-weight: bold;">&lt;?</span><span style="color: #339933;">&amp;</span>phpMyAdmin<span style="color: #339933;">=</span>01d7dd3a1764f33b9145cd20ad99db24 the_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; title=&quot;<span style="color: #000000; font-weight: bold;">&lt;?</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;&lt;img src=&quot;<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;">'images'</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> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;&lt;/a&gt;
&lt;/div&gt;</pre></div></div>

<p>*NOTE: The alt tag uses <code>the_title()</code> function which will name your image according to the page/post that its on.</p>
<p>and the CSS:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.thumb</span> <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">80px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">80px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span><span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>The CSS is required because the image that you uploaded is probably larger than what you&#8217;d want as a thumbnail. So the overflow:hidden command in the div thats wrapping the image will cut if off to a size that&#8217;ll suit you better.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpguru.co.za/templates/page/how-to-make-good-use-of-custom-fields/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

