index.php

Description: The main blog page. Displays a list of blog posts in reverse chronological order.

This template includes the following templates:

Template Code

<?php get_header(); ?>

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

	<?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_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: ', ', ', '<br />'); ?> 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 include (TEMPLATEPATH . "/searchform.php"); ?>

	<?php endif; ?>

	</div>

<?php get_sidebar(); ?>

<?php get_footer(); ?>

This template includes the following tags:

  • comments_popup_link() is a WordPress tag which displays a link either to the comments pop-up window or to the normal comments page, depending on which has been selected in the current template.
  • edit_post_link() is a Wordpress tag which displays a link to edit the current post (assuming the user is logged in and has the appropriate permissions).
  • get_footer() is a WordPress include tag which includes the file footer.php.
  • get_header() is a WordPress include tag which includes the file header.php.
  • get_sidebar() is a WordPress include tag which includes the file sidebar.php.
  • have_posts() is part of The Loop.
  • next_posts_link() is a WordPress tag. Counterintuitively, it creates a link to the previous posts.
  • previous_posts_link() is a WordPress tag. Despite its name, it creates a link to the next posts.
  • the_author() is a WordPress tag which displays the name of the post's author. This tag must be used within The Loop.
  • the_category() is a WordPress tag which displays a link to the category or categories that a post belongs to. This tag must be used within The Loop.
  • the_content() is a Wordpress tag which displays the contents of the current post. This tag must be used within The Loop.
  • the_tags() is a WordPress tag which displays a link to the tag or tags a post belongs to. This tag should be used within The Loop..
  • the_permalink() is a WordPress tag which displays the URL for the permalink to the post currently being processed in The Loop. This tag must be used within The Loop.
  • the_post() is a WP_Query method: "Advance onto the next post, and set the global $post variable."
  • have_posts() is part of The Loop.
  • the_ID() is a WordPress tag which displays the numeric ID of the current post. It must be within The Loop.
  • the_time() is a WordPress tag which displays the time of the current post. This tag must be used within The Loop.
  • the_title_attribute() is a WordPress tag which displays or returns the title of the current post. This tag must be used within The Loop.
  • the_title() is a WordPress tag which displays or returns the title of the current post. This tag must be used within The Loop.

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>[POST TITLE]</h2>
		<small>[DATE]</small>
		<div class="entry">
			<p>[POST CONTENT]</p>
		</div>
		<p class="postmetadata">Tags: [TAGS]</p>
	</div>

	<div class="navigation">
		<div class="alignleft">« Older Entries</div>
		<div class="alignright">Newer Entries »</div>
	</div>

</div>

[SIDEBAR.PHP]

[FOOTER.PHP]

Related CSS Styles

Resources

  • N/A