Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
WordPress Theme Development

The WordPress Loop

Use The Loop to output posts the WordPress way.

The WordPress Loop — a practical guide to WordPress Loop with clear examples you can reuse in real projects.

WordPress Theme Development Series (22/96). Prefer one article? Read the complete WordPress theme development tutorial.

Short description

The Loop checks `have_posts()`, sets up post data with `the_post()`, then prints tags like `the_title()` and `the_content()`.

Standard Loop

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  <?php the_title('<h2>', '</h2>'); ?>
  <?php the_content(); ?>
<?php endwhile; endif; ?>

Leave a reply

Your email address will not be published. Required fields are marked *