From 68d7f0d172d40a291c033325e9615baabbbf04b5 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Sun, 14 Feb 2010 07:13:34 +0000 Subject: [PATCH] Move the Loop into a separate file. Reduces code duplication and adds Gallery/Aside styling to all archive views. See #9015 git-svn-id: https://develop.svn.wordpress.org/trunk@13141 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-content/themes/twentyten/archive.php | 43 +-------- wp-content/themes/twentyten/author.php | 43 +-------- wp-content/themes/twentyten/category.php | 43 +-------- wp-content/themes/twentyten/footer.php | 2 +- wp-content/themes/twentyten/header.php | 9 +- wp-content/themes/twentyten/index.php | 105 +--------------------- wp-content/themes/twentyten/loop.php | 107 +++++++++++++++++++++++ wp-content/themes/twentyten/search.php | 52 +---------- wp-content/themes/twentyten/tag.php | 43 +-------- 9 files changed, 123 insertions(+), 324 deletions(-) create mode 100644 wp-content/themes/twentyten/loop.php diff --git a/wp-content/themes/twentyten/archive.php b/wp-content/themes/twentyten/archive.php index c9a3e2cfde..d8c1e56a01 100644 --- a/wp-content/themes/twentyten/archive.php +++ b/wp-content/themes/twentyten/archive.php @@ -11,52 +11,13 @@

%s', 'twentyten' ), get_the_date('F Y') ); ?>

%s', 'twentyten' ), get_the_date('Y') ); ?>

- +

-max_num_pages; if ( $total_pages > 1 ) { ?> - - - - - -
> -

- - - -
-→', 'twentyten' ) ); ?> -
- -
- - - ' . __('Tagged ', 'twentyten' ) . '', ", ", "\n\t\t\t\t\t\t|\n" ); ?> - - |\n\t\t\t\t\t\t", "\n\t\t\t\t\t\n" ); ?> -
-
- - - -max_num_pages; if ( $total_pages > 1 ) { ?> - - + diff --git a/wp-content/themes/twentyten/author.php b/wp-content/themes/twentyten/author.php index 7cbbec21cd..6c27b3b914 100644 --- a/wp-content/themes/twentyten/author.php +++ b/wp-content/themes/twentyten/author.php @@ -5,7 +5,7 @@ -

%s', 'twentyten' ), "" . esc_html($authordata->display_name) . "" ); ?>

+

%s', 'twentyten' ), "" . get_the_author() . "" ); ?>

@@ -13,7 +13,7 @@
-

+

@@ -21,44 +21,7 @@ -max_num_pages; if ( $total_pages > 1 ) { ?> - - - - - -
> -

- - - -
- →', 'twentyten' ) ); ?> -
- -
- - | - ' . __('Tagged ', 'twentyten' ) . '', ", ", "\n\t\t\t\t\t\t|\n" ); ?> - - |\n\t\t\t\t\t\t", "\n\t\t\t\t\t\n" ); ?> -
-
- - - -max_num_pages; if ( $total_pages > 1 ) { ?> - - + diff --git a/wp-content/themes/twentyten/category.php b/wp-content/themes/twentyten/category.php index 768a714294..4614cd1565 100644 --- a/wp-content/themes/twentyten/category.php +++ b/wp-content/themes/twentyten/category.php @@ -10,48 +10,7 @@ -max_num_pages; if ( $total_pages > 1 ) { ?> - - - - - -
> -

- - - -
- →', 'twentyten' ) ); ?> -
- -
- - - - - ' . __('Tagged ', 'twentyten' ) . '', ", ", "\n\t\t\t\t\t\t|\n" ); ?> - - |\n\t\t\t\t\t\t", "\n\t\t\t\t\t\n" ); ?> -
-
- - - -max_num_pages; if ( $total_pages > 1 ) { ?> - - + diff --git a/wp-content/themes/twentyten/footer.php b/wp-content/themes/twentyten/footer.php index ac6f524ad3..2bac7ad627 100644 --- a/wp-content/themes/twentyten/footer.php +++ b/wp-content/themes/twentyten/footer.php @@ -6,7 +6,7 @@
- +
diff --git a/wp-content/themes/twentyten/header.php b/wp-content/themes/twentyten/header.php index 371478b005..07e424e9e3 100644 --- a/wp-content/themes/twentyten/header.php +++ b/wp-content/themes/twentyten/header.php @@ -39,14 +39,13 @@
-
+
ID ) ) { - echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' ); - } else { ?> + if ( is_singular() && has_post_thumbnail( $post->ID ) ) { + echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' ); + } else { ?>
diff --git a/wp-content/themes/twentyten/index.php b/wp-content/themes/twentyten/index.php index de67d33ede..eb6b9f09a6 100644 --- a/wp-content/themes/twentyten/index.php +++ b/wp-content/themes/twentyten/index.php @@ -3,101 +3,9 @@
-max_num_pages; if ( $total_pages > 1 ) { ?> - - - - - -
> -

- - - -
- -

%2$s photos.', 'twentyten'), 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__('Permalink to %s', 'twentyten'), the_title_attribute('echo=0') ) . '" rel="bookmark"', $total_images ); ?>

- - -
- -
- - - - - |\n\t\t\t\t\t\t", "\n\t\t\t\t\t\n" ); ?> -
-
- - - -
> -
- →', 'twentyten' ) ); ?> -
- -
- - - - - - - |\n\t\t\t\t\t\t", "\n\t\t\t\t\t\n" ); ?> -
-
- - - -
> -

- - - -
- →', 'twentyten' ) ); ?> - ' . __( 'Pages:', 'twentyten' ) . '&after=
'); ?> -
- -
- - - ' . __('Tagged ', 'twentyten' ) . '', ", ", "\n\t\t\t\t\t\t|\n" ); ?> - - |\n\t\t\t\t\t\t", "\n\t\t\t\t\t\n" ); ?> -
-
- - - - - - +

@@ -105,13 +13,6 @@ the_permalink(); ?>" title="" rel="bookmark"> - - -
- -
diff --git a/wp-content/themes/twentyten/loop.php b/wp-content/themes/twentyten/loop.php new file mode 100644 index 0000000000..7d58d74f0e --- /dev/null +++ b/wp-content/themes/twentyten/loop.php @@ -0,0 +1,107 @@ +max_num_pages > 1 ) { ?> + + + + + +
> +

+ + + +
+ +

%2$s photos.', 'twentyten'), 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__('Permalink to %s', 'twentyten'), the_title_attribute('echo=0') ) . '" rel="bookmark"', $total_images ); ?>

+ + +
+ +
+ + + + + |\n\t\t\t\t\t\t", "\n\t\t\t\t\t\n" ); ?> +
+
+ + + +
> +
+ →', 'twentyten' ) ); ?> +
+ +
+ + + + + + + |\n\t\t\t\t\t\t", "\n\t\t\t\t\t\n" ); ?> +
+
+ + + +
> +

+ + + + +
+ →', 'twentyten' ) ); ?> +
+ +
+ →', 'twentyten' ) ); ?> + ' . __( 'Pages:', 'twentyten' ) . '&after=
'); ?> +
+ + +
+ + + ' . __('Tagged ', 'twentyten' ) . '', ", ", "\n\t\t\t\t\t\t|\n" ); ?> + + |\n\t\t\t\t\t\t", "\n\t\t\t\t\t\n" ); ?> +
+
+ + + + + + +max_num_pages > 1 ) { ?> + + \ No newline at end of file diff --git a/wp-content/themes/twentyten/search.php b/wp-content/themes/twentyten/search.php index 68477b0b37..7fa68a3f06 100644 --- a/wp-content/themes/twentyten/search.php +++ b/wp-content/themes/twentyten/search.php @@ -4,57 +4,9 @@
-

- -max_num_pages; if ( $total_pages > 1 ) { ?> - - - - - -
> -

- -post_type != 'page' ) : ?> - - - -
- →', 'twentyten' ) ); ?> - ' . __( 'Pages:', 'twentyten' ) . '&after=
' ); ?> -
- -post_type != 'page' ) : ?> -
- - | - ' . __('Tagged ', 'twentyten' ) . '', ", ", "\n\t\t\t\t\t\t|\n" ); ?> - - |\n\t\t\t\t\t\t", "\n\t\t\t\t\t\n" ); ?> -
- -
- - - -max_num_pages; if ( $total_pages > 1 ) { ?> - - - + -

@@ -62,9 +14,7 @@
- - diff --git a/wp-content/themes/twentyten/tag.php b/wp-content/themes/twentyten/tag.php index 99d5962543..e768230c40 100644 --- a/wp-content/themes/twentyten/tag.php +++ b/wp-content/themes/twentyten/tag.php @@ -9,48 +9,7 @@ -max_num_pages; if ( $total_pages > 1 ) { ?> - - - - - -
> -

- - - -
- →', 'twentyten' ) ); ?> -
- -
- - - - - - - |\n\t\t\t\t\t\t", "\n\t\t\t\t\t\n" ); ?> -
-
- - - -max_num_pages; if ( $total_pages > 1 ) { ?> - - +