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="container">
<div id="content">
<?php the_post() ?>
<?php if ( is_day() ) : ?>
<h2 class="page-title"><?php printf(__('Daily Archives: <span>%s</span>', 'sandbox'), get_the_time(get_option('date_format'))) ?></h2>
<?php elseif ( is_month() ) : ?>
<h2 class="page-title"><?php printf(__('Monthly Archives: <span>%s</span>', 'sandbox'), get_the_time('F Y')) ?></h2>
<?php elseif ( is_year() ) : ?>
<h2 class="page-title"><?php printf(__('Yearly Archives: <span>%s</span>', 'sandbox'), get_the_time('Y')) ?></h2>
<?php elseif ( isset($_GET['paged']) && !empty($_GET['paged']) ) : ?>
<h2 class="page-title"><?php _e('Blog Archives', 'sandbox') ?></h2>
<?php endif; ?>
<?php rewind_posts() ?>
<div id="nav-above" class="navigation">
<div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">«</span> Older posts', 'sandbox')) ?></div>
<div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">»</span>', 'sandbox')) ?></div>
</div>
<?php while ( have_posts() ) : the_post(); ?>
<div id="post-<?php the_ID() ?>" class="<?php sandbox_post_class() ?>">
<h3 class="entry-title"><a href="<?php the_permalink() ?>" title="<?php printf(__('Permalink to %s', 'sandbox'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark"><?php the_title() ?></a></h3>
<div class="entry-date"><abbr class="published" title="<?php the_time('Y-m-d\TH:i:sO'); ?>"><?php unset($previousday); printf(__('%1$s – %2$s', 'sandbox'), the_date('', '', '', false), get_the_time()) ?></abbr></div>
<div class="entry-content">
<?php the_excerpt(''.__('Read More <span class="meta-nav">»</span>', 'sandbox').'') ?>
</div>
<div class="entry-meta">
<span class="author vcard"><?php printf(__('By %s', 'sandbox'), '<a class="url fn n" href="'.get_author_link(false, $authordata->ID, $authordata->user_nicename).'" title="' . sprintf(__('View all posts by %s', 'sandbox'), $authordata->display_name) . '">'.get_the_author().'</a>') ?></span>
<span class="meta-sep">|</span>
<span class="cat-links"><?php printf(__('Posted in %s', 'sandbox'), get_the_category_list(', ')) ?></span>
<span class="meta-sep">|</span>
<?php the_tags(__('<span class="tag-links">Tagged ', 'sandbox'), ", ", "</span>\n\t\t\t\t\t<span class=\"meta-sep\">|</span>\n") ?>
<?php edit_post_link(__('Edit', 'sandbox'), "\t\t\t\t\t<span class=\"edit-link\">", "</span>\n\t\t\t\t\t<span class=\"meta-sep\">|</span>\n"); ?>
<span class="comments-link"><?php comments_popup_link(__('Comments (0)', 'sandbox'), __('Comments (1)', 'sandbox'), __('Comments (%)', 'sandbox')) ?></span>
</div>
</div><!-- .post -->
<?php endwhile ?>
<div id="nav-below" class="navigation">
<div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">«</span> Older posts', 'sandbox')) ?></div>
<div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">»</span>', 'sandbox')) ?></div>
</div>
</div><!-- #content .hfeed -->
</div><!-- #container -->
<?php get_sidebar() ?>
<?php get_footer() ?>
This template includes the following tags:
__()is a WordPress function used to mark a string for translation to another language. It is similar to_e(), except that__()returns the string while_e()echoes it._e()is a WordPress function used to mark a string for translation to another language. It is similar to__(), except that__()returns the string while_e()echoes it.bloginfo()is a WordPress function that displays information about your blog. Using various parameters, the function can display the following strings:- Blog title;
- Blog tagline;
- Administrator's email address;
- Document content-type;
- Document charset;
- WordPress version;
- Blog URL;
- Pingback URL;
- URL of the RSS 0.92, RSS 1.0, RSS 2.0, or Atom feed;
- URL of the comments feed;
- URL of the directory in which WordPress is installed;
- URL of the current template's directory;
- URL of the current
style.cssfile; - URL of the stylesheet directory (deprecated)
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_author_link()has been deprecated. Developers are advised to useget_author_posts_url()instead.get_footeris a WordPress include tag which includes the filefooter.php.get_headeris a WordPress include tag which includes the fileheader.php.get_option()is a WordPress tag used to get a named option from the options database table. See the Option Reference for a list of valid parameters.get_sidebaris a WordPress include tag which includes the filesidebar.php.get_the_author()is a WordPress tag which returns the name of the author of the post.get_the_category_list()is a WordPress function which creates a list of categories.get_the_time()is a WordPress tag which returns the time of the current post. It must be used within The Loop.get_the_title()is a WordPress tag which accepts a post ID and returns the title of the post.have_posts()is part of The Loop.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_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. Despite its name, 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.printf()is a PHP string function used to output a formatted string.rewind_posts()can be used to have multiple instances of The Loop.sandbox_post_class()is a Sandbox-specific class defined in thefunctions.phpfile. According to the Sandbox Readme, "It adds semantic classes to each postdivelement, relative to the actual post it contains."sprintf()is a PHP string function which returns a formatted string.the_excerpt()is a WordPress tag which displays an excerpt of the current post, followed by an ellipsis. See support for this tag.the_ID()is a WordPress tag which displays the numeric ID of the current post. This tag must 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 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.unset()is a PHP variable handling function which destroys the specified variables. (According to a note in the PHP Manual,unset()is actually not a function, but a language construct.)wp_specialchars()is a WordPress function that is "like the PHP function htmlspecialchars except it doesn't double-encode HTML entities." (Function Reference)
HTML Skeleton
[HEADER.PHP] <div id="container"> <div id="content"> <div id="post-[#]" class="hentry p1 page publish author-[AUTHOR] category-[CATEGORY] tag-[TAG] y[YEAR] m[MONTH] d[DAY] h[HOUR]"> <h2 class="entry-title">Archive Index</h2> <div id="nav-below" class="navigation"> <div class="nav-previous"> <span class="meta-nav">«</span> Older posts </div> <div class="nav-next"> <span class="meta-nav">»</span> Newer posts </div> </div> <div class="entry-content"> <ul id="archives-page" class="xoxo"> <li id="category-archives" class="content-column"> <h3>Archives by Category</h3> <ul> <li class="cat-item cat-item-[#]">[CATEGORY]([RSS])</li> </ul> </li> <li id="monthly-archives" class="content-column"> <h3>Archives by Month</h3> <ul> <li>[LINK]</li> </ul> </li> </ul> <span class="edit-link">Edit</span> </div> </div> <!-- .post --> </div> <!-- #content --> </div> <!-- #container --> [SIDEBAR.PHP] [FOOTER.PHP]
Related CSS Styles
Resources
- N/A