Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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!