The Loop, by default (read: the Loop in Default Theme) display the Posts chronologically with the most recent Post at the very top followed by less recent Posts.
The following is a sample of common usage of the Loop in theme’s index.php
to have a journal-like WordPress installation.
<?php get_header(); ?>
<div id="content">
<?php if( have_posts() ) : ?>
<?php while( have_posts() ) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<div class="meta"><?php the_category( ', ' ); ?> <?php the_author(); ?> <?php the_time('F jS, Y'); ?></div>
<div class="entry">
<?php the_content(); ?>
</div>
</div>
<?php endwhile; ?>
<?php else : ?>
<div class="error">
<h2>Not Found</h2>
<p>Sorry, but you are looking for something that isn't here.</p>
<?php include( TEMPLATEPATH . '/searchform.php' ); ?>
</div>
<?php endif; ?>
</div>
<?php get_footer(); ?>
Line 7
indicates the start of the Loop and line 17
ends it. Inside the Loop, Post data are displayed through the call of several Template Tags such as the_title()
, the_category()
, the_author()
, and the_content()
. Any other Post-related Template Tags can be placed within the Loop and the corresponding output will be displayed with each Post.
Pingback: Rhymed Code » Asides
Pingback: Wyoming Home Equity Loan