page.php

Description: Displays a page, as opposed to a post.

This template includes the following templates:

Template Code

<?php get_header(); ?>

	<div id="content" class="narrowcolumn">

		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
		<div class="post" id="post-<?php the_ID(); ?>">
		<h2><?php the_title(); ?></h2>
			<div class="entry">
				<?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>

				<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>

			</div>
		</div>
		<?php endwhile; endif; ?>
	<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
	</div>

<?php get_sidebar(); ?>

<?php get_footer(); ?>

This template includes the following tags:

  • edit_post_link()
  • get_footer() is an include tag which includes the file footer.php.
  • get_header() is an include tag which includes the file header.php.
  • get_sidebar() is an include tag which includes the file sidebar.php.
  • have_posts()
  • the_content()
  • the_ID()
  • the_post()
  • the_title()
  • wp_link_pages()

Other:

  • All the code between <?php if (have_posts()) : ?> and <?php endwhile; ?> constitutes The Loop.

HTML Skeleton

[HEADER.PHP]

<div id="content" class="narrowcolumn">

	<div class="post" id="post-[#]">
		<h2>[PAGE TITLE]</h2>
		<div class="entry">
			<p>[PAGE CONTENT]</p>
		</div>
	</div>
	<p>Edit this entry.</p>

</div>

[SIDEBAR.PHP]

[FOOTER.PHP]

Related CSS Styles

Resources

  • Pages (WordPress Codex)