Posts Tagged ‘if’

If, Then, Else

August 9th, 2008

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. < ?php if (have_posts()) : ?> 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 “The Loop“. <? php while (have_posts()) : the_post(); […]

[Continue Reading...]

Obviously Powered by WordPress. © 2003-2013

page counter