archive.php
Description: 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 is_tag(); ?>
<?php if (have_posts()) : ?>
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
<?php /* If this is a category archive */ if (is_category()) { ?>
<h2 class="pagetitle">Archive for the ‘<?php single_cat_title(); ?>’ Category</h2>
<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
<h2 class="pagetitle">Posts Tagged ‘<?php single_tag_title(); ?>’</h2>
<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
<h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2>
<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
<h2 class="pagetitle">Archive for <?php the_time('F, Y'); ?></h2>
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
<h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2>
<?php /* If this is an author archive */ } elseif (is_author()) { ?>
<h2 class="pagetitle">Author Archive</h2>
<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
<h2 class="pagetitle">Blog Archives</h2>
<?php } ?>
<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 while (have_posts()) : the_post(); ?>
<div class="post">
<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
<small><?php the_time('l, F jS, Y') ?></small>
<div class="entry">
<?php the_content() ?>
</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>
<?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 filefooter.php.get_header()is a WordPress include tag which includes the fileheader.php.get_sidebar()is a WordPress include tag which includes the filesidebar.php.have_posts()returns true if at least one post is available in the current query.is_author()is a WordPress conditional tag which returns TRUE when an Author page is being displayed.is_category()is a WordPress conditional tag which returns TRUE when a Category page is being displayed.is_day()is a Wordpress conditional tag which returns true when a daily archive is being displayed.is_month()is a Wordpress conditional tag which returns true when a monthly archive is being displayed.is_tag()is a Wordpress conditional tag which returns true when a tag page is being displayed.is_year()is a Wordpress conditional tag which returns true when a yearly archive is being displayed.isset()is a PHP variable handling function which determines whether a variable has been set. (According to a note in the PHP Manual,isset()is actually not a function, but a language construct.)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.single_cat_title()is a WordPress tag which displays or returns the category title for the current page.single_tag_title()is a WordPress tag which displays or returns the tag title for the current page.the_content()is a Wordpress tag which displays the contents of the current post. This tag must be used within The Loop.the_ID()is a WordPress tag which displays the numeric ID of the current post. It must be 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 aWP_Querymethod: "Advance onto the next post, and set the global $post variable."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_time()is a WordPress tag which displays the time 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.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.
HTML Skeleton
[HEADER.PHP] <div id="content" class="narrowcolumn"> <h2 class="pagetitle">Archive for [MONTH], [YEAR]</h2> <div class="navigation"> <div class="alignleft">« Older Entries</div> <div class="alignright">Newer Entries »</div> </div> <div class="post"> <h3 id="post-[#]">[POST TITLE]</h3> <small>[DATE]</small> <div class="entry"> <p>[POST CONTENT]</p> </div> <p class="postmetadata"> Tags: [TAGS]<br /> Posted in [CATEGORIES] | [#] Comments » </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