<?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>Weblog Tools Collection &#187; if</title>
	<atom:link href="http://weblogtoolscollection.com/archives/tag/if/feed/" rel="self" type="application/rss+xml" />
	<link>http://weblogtoolscollection.com</link>
	<description>Weblog Tools Blogging Tools Blog</description>
	<lastBuildDate>Mon, 13 Feb 2012 13:00:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>If, Then, Else</title>
		<link>http://weblogtoolscollection.com/archives/2008/08/09/if-then-else/</link>
		<comments>http://weblogtoolscollection.com/archives/2008/08/09/if-then-else/#comments</comments>
		<pubDate>Sat, 09 Aug 2008 19:27:09 +0000</pubDate>
		<dc:creator>Jeff Chandler</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[else]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[if]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[then]]></category>

		<guid isPermaLink="false">http://weblogtoolscollection.com/?p=3894</guid>
		<description><![CDATA[Ever become brave enough to look inside of a WordPress php file? Specifically, a php file from a theme? If you have, you may have noticed that they are filled with If, Then, and Else statements. If you have no idea what these mean, this post is for you. Php has always been a pain for me to understand, but if you think about it in a logical manner, it begins to make sense. If, then and else statements are used as a means of making decisions, similar to the way you and I make decisions in the real world. Here is an example of how this logic works in WordPress. &#60; ?php if (have_posts()) : ?&#62; The if statement within that php function is asking if there are posts. If the blog has posts, WordPress begins processing what is known as &#8220;The Loop&#8220;. &#60;? php while (have_posts()) : the_post(); [...]]]></description>
			<content:encoded><![CDATA[<p>Ever become brave enough to look inside of a WordPress php file? Specifically, a php file from a theme? If you have, you may have noticed that they are filled with If, Then, and Else statements. If you have no idea what these mean, this post is for you.</p>
<p>Php has always been a pain for me to understand, but if you think about it in a logical manner, it begins to make sense. If, then and else statements are used as a means of making decisions, similar to the way you and I make decisions in the real world. Here is an example of how this logic works in WordPress.</p>
<p><strong>&lt; ?php if (have_posts()) : ?&gt;</strong></p>
<p>The if statement within that php function is asking if there are posts. If the blog has posts, WordPress begins processing what is known as &#8220;<a title="http://codex.wordpress.org/the_loop" href="http://codex.wordpress.org/the_loop" target="_blank">The Loop</a>&#8220;.</p>
<p><strong>&lt;? php while (have_posts()) : the_post(); ?&gt;</strong></p>
<p>This piece of code tells WordPress to grab the posts from the MySQL database and display them on your blog. The loop then closes with this function.</p>
<p><strong>&lt;?php endwhile; ?&gt;</strong></p>
<p>If the answer to the <strong>if</strong> question turns out to be no, WordPress bypasses the loop and displays a message that no posts exist. This is where the <strong>else</strong> statement comes into play.</p>
<p><strong><br />
&lt; h2 class=&#8221;center&#8221;&gt;Not Found&lt; /h2&gt;<br />
&lt; p class=&#8221;center&#8221;&gt;Sorry, but you are looking for something that isn&#8217;t here.&lt; /p&gt;<br />
&lt; ?php include (TEMPLATEPATH . &#8220;/searchform.php&#8221;); ?&gt;<br />
&lt; ?php endif; ?&gt;</strong></p>
<p>That last line of code is the if statement and concludes the function.</p>
<p><strong>If</strong>, <strong>then</strong>, and <strong>else</strong> are easy to remember when you think of how you <strong>function</strong> on a daily basis. A real world example, (<strong>If</strong> I am hungry, <strong>Then</strong> I&#8217;ll eat some food, or <strong>Else</strong> I&#8217;ll starve). Maybe not the best example in the world, but you should be able to get the picture.</p>
<p>I&#8217;m no coder by any means but when I read explanations about statements and functions inside of WordPress via Lisa Sabin Wilson&#8217;s <a title="WordPress For Dummies At Amazon" href="http://www.amazon.com/WordPress-Dummies-Computer-Tech/dp/0470149469/ref=pd_bbs_sr_1?ie=UTF8&amp;s=books&amp;qid=1218309580&amp;sr=1-1" target="_blank">WordPress For Dummies</a>, it&#8217;s as if light bulbs turn on inside of my head. One of those &#8220;Ohhhh, so thats what that does&#8221; sort of moments.</p>
<p>Be sure to let me know if this post was of any help to you.</p>
]]></content:encoded>
			<wfw:commentRss>http://weblogtoolscollection.com/archives/2008/08/09/if-then-else/feed/</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  weblogtoolscollection.com/archives/tag/if/feed/ ) in 0.72554 seconds, on Feb 14th, 2012 at 9:31 am UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 14th, 2012 at 10:31 am UTC -->
