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 trial

PHP How to Build a WordPress Theme WordPress Theme Functions The WordPress Loop

Brittany Cerra
Brittany Cerra
7,424 Points

General PHP question about the elements in this loop.

Hi!

I'm forgetting something basic, and I'm having trouble tracking down the specific answer.

In this beginning section of a loop:

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

Why are the empty parentheses necessary? Is this where an argument would go?

Thanks :)

1 Answer

Daniel Barreto
PLUS
Daniel Barreto
Courses Plus Student 14,978 Points

If i remember correctly, In PHP, and most programming languages, functions require those parentheses as part of the syntax. Some functions take arguments, and others don't but those parentheses are what distinguish them as functions.

Brittany Cerra
Brittany Cerra
7,424 Points

Got it! Thanks, Daniel!