Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialjason chan
31,009 PointsWordpress while loop
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h1><?php the_title(); ?></h1>
<p><?php the_content(); ?></p>
<?php endwhile; else : ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
what does the colon mean in the if statement. I'm confused about that. I never used it syntax before.
2 Answers
Kevin Korte
28,149 PointsIts a shorthand syntax, which helps keep the code clean. http://php.net/manual/en/control-structures.alternative-syntax.php
jason chan
31,009 Pointsthanks man. it's like python then. I prefer coding in php though.