Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

_s: With so little variation among date archive, category arhive, and…

… tag archive, we can safely combine those templates without overcomplicating things.
  • Loading branch information...
commit 73ffdba03cd42453f0938ca5b961e00a1193ca08 1 parent ae85c2b
Ian Stewart authored January 12, 2012
40  archive.php
@@ -2,9 +2,6 @@
2 2
 /**
3 3
  * The template for displaying Archive pages.
4 4
  *
5  
- * Used to display archive-type pages if nothing more specific matches a query.
6  
- * For example, puts together date-based pages if no date.php file exists.
7  
- *
8 5
  * Learn more: http://codex.wordpress.org/Template_Hierarchy
9 6
  *
10 7
  * @package _s
@@ -21,17 +18,44 @@
21 18
 				<header class="page-header">
22 19
 					<h1 class="page-title">
23 20
 						<?php
24  
-							if ( is_day() ) :
  21
+							if ( is_category() ) {
  22
+								printf( __( 'Category Archives: %s', '_s' ), '<span>' . single_cat_title( '', false ) . '</span>' );
  23
+
  24
+							} elseif ( is_tag() ) {
  25
+								printf( __( 'Tag Archives: %s', '_s' ), '<span>' . single_tag_title( '', false ) . '</span>' );
  26
+
  27
+							} elseif ( is_author() ) {
  28
+								printf( __( 'Author Archives: %s', '_s' ), '<span class="vcard"><a class="url fn n" href="' . get_author_posts_url( get_the_author_meta( "ID" ) ) . '" title="' . esc_attr( get_the_author() ) . '" rel="me">' . get_the_author() . '</a></span>' );
  29
+
  30
+							} elseif ( is_day() ) {
25 31
 								printf( __( 'Daily Archives: %s', '_s' ), '<span>' . get_the_date() . '</span>' );
26  
-							elseif ( is_month() ) :
  32
+
  33
+							} elseif ( is_month() ) {
27 34
 								printf( __( 'Monthly Archives: %s', '_s' ), '<span>' . get_the_date( 'F Y' ) . '</span>' );
28  
-							elseif ( is_year() ) :
  35
+
  36
+							} elseif ( is_year() ) {
29 37
 								printf( __( 'Yearly Archives: %s', '_s' ), '<span>' . get_the_date( 'Y' ) . '</span>' );
30  
-							else :
  38
+
  39
+							} else {
31 40
 								_e( 'Archives', '_s' );
32  
-							endif;
  41
+
  42
+							}
33 43
 						?>
34 44
 					</h1>
  45
+					<?php
  46
+						if ( is_category() ) {
  47
+							// show an optional category description
  48
+							$category_description = category_description();
  49
+							if ( ! empty( $category_description ) )
  50
+								echo apply_filters( 'category_archive_meta', '<div class="taxonomy-description">' . $category_description . '</div>' );
  51
+
  52
+						} elseif ( is_tag() ) {
  53
+							// show an optional tag description
  54
+							$tag_description = tag_description();
  55
+							if ( ! empty( $tag_description ) )
  56
+								echo apply_filters( 'tag_archive_meta', '<div class="taxonomy-description">' . $tag_description . '</div>' );
  57
+						}
  58
+					?>
35 59
 				</header>
36 60
 
37 61
 				<?php rewind_posts(); ?>
64  category.php
... ...
@@ -1,64 +0,0 @@
1  
-<?php
2  
-/**
3  
- * The template for displaying Category Archive pages.
4  
- *
5  
- * @package _s
6  
- * @since _s 1.0
7  
- */
8  
-
9  
-get_header(); ?>
10  
-
11  
-		<section id="primary">
12  
-			<div id="content" role="main">
13  
-
14  
-			<?php if ( have_posts() ) : ?>
15  
-
16  
-				<header class="page-header">
17  
-					<h1 class="page-title"><?php
18  
-						printf( __( 'Category Archives: %s', '_s' ), '<span>' . single_cat_title( '', false ) . '</span>' );
19  
-					?></h1>
20  
-
21  
-					<?php
22  
-						$category_description = category_description();
23  
-						if ( ! empty( $category_description ) )
24  
-							echo apply_filters( 'category_archive_meta', '<div class="category-archive-meta">' . $category_description . '</div>' );
25  
-					?>
26  
-				</header>
27  
-
28  
-				<?php _s_content_nav( 'nav-above' ); ?>
29  
-
30  
-				<?php /* Start the Loop */ ?>
31  
-				<?php while ( have_posts() ) : the_post(); ?>
32  
-
33  
-					<?php
34  
-						/* Include the Post-Format-specific template for the content.
35  
-						 * If you want to overload this in a child theme then include a file
36  
-						 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
37  
-						 */
38  
-						get_template_part( 'content', get_post_format() );
39  
-					?>
40  
-
41  
-				<?php endwhile; ?>
42  
-
43  
-				<?php _s_content_nav( 'nav-below' ); ?>
44  
-
45  
-			<?php else : ?>
46  
-
47  
-				<article id="post-0" class="post no-results not-found">
48  
-					<header class="entry-header">
49  
-						<h1 class="entry-title"><?php _e( 'Nothing Found', '_s' ); ?></h1>
50  
-					</header><!-- .entry-header -->
51  
-
52  
-					<div class="entry-content">
53  
-						<p><?php _e( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', '_s' ); ?></p>
54  
-						<?php get_search_form(); ?>
55  
-					</div><!-- .entry-content -->
56  
-				</article><!-- #post-0 -->
57  
-
58  
-			<?php endif; ?>
59  
-
60  
-			</div><!-- #content -->
61  
-		</section><!-- #primary -->
62  
-
63  
-<?php get_sidebar(); ?>
64  
-<?php get_footer(); ?>
66  tag.php
... ...
@@ -1,66 +0,0 @@
1  
-<?php
2  
-/**
3  
- * The template used to display Tag Archive pages
4  
- *
5  
- * @package _s
6  
- * @since _s 1.0
7  
- */
8  
-
9  
-get_header(); ?>
10  
-
11  
-		<section id="primary">
12  
-			<div id="content" role="main">
13  
-
14  
-			<?php if ( have_posts() ) : ?>
15  
-
16  
-				<header class="page-header">
17  
-					<h1 class="page-title"><?php
18  
-						printf( __( 'Tag Archives: %s', '_s' ), '<span>' . single_tag_title( '', false ) . '</span>' );
19  
-					?></h1>
20  
-
21  
-					<?php
22  
-						$tag_description = tag_description();
23  
-						if ( ! empty( $tag_description ) )
24  
-							echo apply_filters( 'tag_archive_meta', '<div class="tag-archive-meta">' . $tag_description . '</div>' );
25  
-					?>
26  
-				</header>
27  
-
28  
-				<?php rewind_posts(); ?>
29  
-
30  
-				<?php _s_content_nav( 'nav-above' ); ?>
31  
-
32  
-				<?php /* Start the Loop */ ?>
33  
-				<?php while ( have_posts() ) : the_post(); ?>
34  
-
35  
-					<?php
36  
-						/* Include the Post-Format-specific template for the content.
37  
-						 * If you want to overload this in a child theme then include a file
38  
-						 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
39  
-						 */
40  
-						get_template_part( 'content', get_post_format() );
41  
-					?>
42  
-
43  
-				<?php endwhile; ?>
44  
-
45  
-				<?php _s_content_nav( 'nav-below' ); ?>
46  
-
47  
-			<?php else : ?>
48  
-
49  
-				<article id="post-0" class="post no-results not-found">
50  
-					<header class="entry-header">
51  
-						<h1 class="entry-title"><?php _e( 'Nothing Found', '_s' ); ?></h1>
52  
-					</header><!-- .entry-header -->
53  
-
54  
-					<div class="entry-content">
55  
-						<p><?php _e( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', '_s' ); ?></p>
56  
-						<?php get_search_form(); ?>
57  
-					</div><!-- .entry-content -->
58  
-				</article><!-- #post-0 -->
59  
-
60  
-			<?php endif; ?>
61  
-
62  
-			</div><!-- #content -->
63  
-		</section><!-- #primary -->
64  
-
65  
-<?php get_sidebar(); ?>
66  
-<?php get_footer(); ?>

0 notes on commit 73ffdba

Please sign in to comment.
Something went wrong with that request. Please try again.