archive.php 1.76 KB
Newer Older
godog's avatar
godog committed
1
2
<?php
/**
lucha's avatar
lucha committed
3
 * Template for displaying Archive pages
godog's avatar
godog committed
4
5
6
7
 *
 * Used to display archive-type pages if nothing more specific matches a query.
 * For example, puts together date-based pages if no date.php file exists.
 *
ale's avatar
ale committed
8
 * @link https://codex.wordpress.org/Template_Hierarchy
godog's avatar
godog committed
9
10
11
12
13
14
15
16
17
18
19
20
 *
 * @package WordPress
 * @subpackage Twenty_Ten
 * @since Twenty Ten 1.0
 */

get_header(); ?>

		<div id="container">
			<div id="content" role="main">

<?php
lucha's avatar
lucha committed
21
22
	/*
	 * Queue the first post, that way we know
godog's avatar
godog committed
23
24
25
26
27
	 * what date we're dealing with (if that is the case).
	 *
	 * We reset this later so we can run the loop
	 * properly with a call to rewind_posts().
	 */
lucha's avatar
lucha committed
28
29
	if ( have_posts() )
		the_post();
godog's avatar
godog committed
30
31
32
33
34
35
?>

			<h1 class="page-title">
<?php if ( is_day() ) : ?>
				<?php printf( __( 'Daily Archives: <span>%s</span>', 'twentyten' ), get_the_date() ); ?>
<?php elseif ( is_month() ) : ?>
root's avatar
root committed
36
				<?php printf( __( 'Monthly Archives: <span>%s</span>', 'twentyten' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'twentyten' ) ) ); ?>
godog's avatar
godog committed
37
<?php elseif ( is_year() ) : ?>
root's avatar
root committed
38
				<?php printf( __( 'Yearly Archives: <span>%s</span>', 'twentyten' ), get_the_date( _x( 'Y', 'yearly archives date format', 'twentyten' ) ) ); ?>
godog's avatar
godog committed
39
40
41
42
43
44
<?php else : ?>
				<?php _e( 'Blog Archives', 'twentyten' ); ?>
<?php endif; ?>
			</h1>

<?php
lucha's avatar
lucha committed
45
46
	/*
	 * Since we called the_post() above, we need to
godog's avatar
godog committed
47
48
49
50
51
	 * rewind the loop back to the beginning that way
	 * we can run the loop properly, in full.
	 */
	rewind_posts();

lucha's avatar
lucha committed
52
53
	/*
	 * Run the loop for the archives page to output the posts.
godog's avatar
godog committed
54
	 * If you want to overload this in a child theme then include a file
root's avatar
root committed
55
	 * called loop-archive.php and that will be used instead.
godog's avatar
godog committed
56
	 */
ale's avatar
ale committed
57
	get_template_part( 'loop', 'archive' );
godog's avatar
godog committed
58
59
60
61
62
63
64
?>

			</div><!-- #content -->
		</div><!-- #container -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>