Using built-in WordPress functionality, you can display any information you want, wherever you want. WordPress makes it easy to display vital post data, navigational tools, and many other versatile features 3. To see an example of this in action, replace the previous loop example with the following, fully-pimped version of WordPress looping bliss. This is like the advanced course for understanding the basic WordPress loop. Dig into this, and you will soon be crafting your own, highly specialized loops.
// any code included here occurs before the wordpress loop and is always displayed
<h1><?php echo get_settings('home'); ?>/"><?php bloginfo('name'); ?></a></h1>
<ul class="menu">
<li><a href="<?php echo get_settings('home'); ?>/">Home Page</a></li>
<?php wp_list_pages('sort_column=menu_order&depth=1&title_li='); ?>
<?php wp_register('<li>','</li>'); ?>
</ul>
<?php if (have_posts()) : ?>
// if there are posts to display, process any code included here only once
// display any code output from this region above the entire set of posts
<h2>Here are a few of my recent posts:</h2>
<?php while (have_posts()) : the_post(); ?>
// loop through posts and process each according to the code specified here
// process any code included in this region before the content of each post
<h3><a href="<?php the_permalink() ?>">Title: <?php the_title(); ?></a></h3>
<p>Date: <?php echo date("l, F d, Y"); ?> | <?php comments_number(); ?></p>
<?php the_content(); ?> // this function displays the content of each post
// process any code included in this region after the content of each post
<h4>This is post #<?php the_ID(); ?> | Author: <?php the_author(); ?></h4>
<p>Filed under: <?php the_category(','); ?> | <?php edit_post_link(); ?></p>
<?php endwhile; ?>
// stop the post loop and process any code included here only once
// any code output will be displayed below the entire set of posts
<h4><?php posts_nav_link() ?><?php previous_post_link(); ?> •
<?php posts_nav_link() ?><?php next_post_link(); ?></h4>
<?php else : ?>
// if there are no posts to display, process any code that is included here
// the output of any code included here will be displayed instead of posts
<p>Sorry, no posts matched your criteria.</p>
<?php endif; ?>
// any code included here occurs after the wordpress loop and is always displayed
<h6>Copyright © <?php echo get_settings('home'); ?>/"><?php bloginfo('name'); ?></a> <?php echo date('Y'); ?></h6>