I understand that if else staments should say stuff like:
if dog equals one, do this.
if (dog==1)
But in the following php code it seems like it is saying
If dog then do this (if dog what?)
<?php if ( get_post_meta($post->ID, 'thumb', true) ) : ?>
<a href="<?php the_permalink() ?>" rel="bookmark">
<img class="thumb" src="<?php echo get_post_meta($post->ID, 'thumb', true) ?>" alt="<?php the_title(); ?>" />
</a>
<?php endif; ?>
I feel like it is like a sentence missing its verb.
Can anyone explain that to me in plain English?
The expression used as the condition of an if statement can be anything. Nobody forces you to use a comparison operator The value of the expression is converted into a boolean, and used as the condition.
For an explanation on how different values are converted into booleans, see the manual.
If you feel completely lost without one of your “verbs”, you can always imagine a
== trueat the end of every if statement. Just don’t write that into your code, because== truejust looks silly.