Title: the loop
Last modified: August 20, 2016

---

# the loop

 *  [Demetrius Pop](https://wordpress.org/support/users/demetrius-pop/)
 * (@demetrius-pop)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/the-loop-6/)
 * I am just branching out into template pages and I am trying to get the loop to
   work in my custom theme. the meta data is showing up but not the content of my
   post.
 * the code:
 *     ```
       <?php
       /*
       Template Name: blog
       */
       ?>
   
       <?php get_header(); ?>
   
       <div id="page-wrap" class="container_12 clearfix">
   
       <!-- The Loop -->
   
       <div class="grid_12">
          <? /*Begin Content area Query*/ ?>
       <?php if (have_posts()) : ?>
       <?php while (have_posts()) : the_post(); ?>
       <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
       <h2><a>" rel="bookmark" title="Permanent Link to <?php the_title_attribute();
       ?>"><?php the_title(); ?></a></h2>
       <small><?php the_time('F jS, Y') ?> <!-- by <?php
       the_author() ?> --></small>
       <div class="entry">
       <?php the_content('Read the rest of this entry »'); ?>
       </div>
       <p class="postmetadata"><?php the_tags('Tags: ', ', ', ''); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
       </div>
       <?php endwhile; ?>
       <div class="navigation">
       <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div>
       <div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div>
       </div>
       <?php else : ?>
       <h2 class="center">Not Found</h2>
       <p class="center">Sorry, but you are looking for something that isn't here.</p>
       <?php get_search_form(); ?>
       <?php endif; ?>﻿
   
       </div>
       <!-- End Loop -->
   
       </div>
   
       </div>
   
       <?php get_footer(); ?>
       ```
   
 * _[how to post code: [http://codex.wordpress.org/Forum\_Welcome#Posting\_Code](http://codex.wordpress.org/Forum_Welcome#Posting_Code)]_

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/the-loop-6/#post-3134305)
 * you need to tell the loop what to show;
 * [http://codex.wordpress.org/Function_Reference/query_posts](http://codex.wordpress.org/Function_Reference/query_posts)
 *  Thread Starter [Demetrius Pop](https://wordpress.org/support/users/demetrius-pop/)
 * (@demetrius-pop)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/the-loop-6/#post-3134444)
 * That works, thanks! 🙂
 *  Thread Starter [Demetrius Pop](https://wordpress.org/support/users/demetrius-pop/)
 * (@demetrius-pop)
 * [13 years ago](https://wordpress.org/support/topic/the-loop-6/#post-3134637)
 * I’m curious as to why you chose query_post as opposed to WP_Query?
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years ago](https://wordpress.org/support/topic/the-loop-6/#post-3134638)
 * this does not matter much in a page template where ‘query_posts()’ is be the 
   only query, and makes it easier to add pagination code.
 * of course, the loop can be done with `WP_Query()`.
 * [http://wordpress.stackexchange.com/questions/1753/when-should-you-use-wp-query-vs-query-posts-vs-get-posts?rq=1](http://wordpress.stackexchange.com/questions/1753/when-should-you-use-wp-query-vs-query-posts-vs-get-posts?rq=1)
 *  Thread Starter [Demetrius Pop](https://wordpress.org/support/users/demetrius-pop/)
 * (@demetrius-pop)
 * [13 years ago](https://wordpress.org/support/topic/the-loop-6/#post-3134639)
 * I see. Cool, my question actually came from that thread. Small Internet!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘the loop’ is closed to new replies.

## Tags

 * [the-loop](https://wordpress.org/support/topic-tag/the-loop/)

 * 5 replies
 * 2 participants
 * Last reply from: [Demetrius Pop](https://wordpress.org/support/users/demetrius-pop/)
 * Last activity: [13 years ago](https://wordpress.org/support/topic/the-loop-6/#post-3134639)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
