The WordPress Loop
Add the Loop to a Theme
1
Open index.php in Your Theme
Inside the #primary div, clear out any placeholder content.
2
Wrap with have_posts() Check
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
3
Output the Content
<?php the_content(); ?> renders each post's body.
4
Close the Loop
<?php endwhile; ?> <?php endif; ?> — closes both the while and the if.
Master WordPress at Noble Desktop
Noble Desktop's WordPress Bootcamp teaches themes, plugins, and custom site development.
Learn how to leverage WordPress features for building a dynamic blog section of a website, including displaying posts, adding and customizing posts, and implementing the Loop—a series of WordPress functions that facilitate access to a page's content.
