Loop - ar-to/WordPress-Theme GitHub Wiki

The Loop is Wordpress is responsable for adding the posts' content dynamically inside template pages.

Open index.php and begin by creating a new column inside the row

<div class="col-md-12">
      <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
          <!--Markup... Display post content-->
          <h1 class="text-center">Post</h1>
          <h2><?php the_title(); //shows post title ?></h2>
          <?php the_content(); //add the post content ?>
      <?php endwhile; ?>
      <?php endif; ?>
</div>

The title for the post and its content now shows dynamically. To make the post title a link and to have it point to that post url change <h2> tag with

<h2><a href="<?php the_permalink(); //returns url of current post ?>"><?php the_title(); //shows post title ?></a></h2>

An important note to keep in mind is that the number of posts that show can be controlled in Settings>Reading "Blog pages show at most." This will be important when adding pagination to move between posts.

⚠️ **GitHub.com Fallback** ⚠️