From 8902f273ce80159e4acf288d50520bd9b10911b7 Mon Sep 17 00:00:00 2001 From: dd32 Date: Sun, 14 Feb 2010 10:02:38 +0000 Subject: [PATCH] Replace $authordata usage with API, Restore "Also posted in.."/"Also tagged..." on taxonomy archives, Handle Excerpts for Asides correctly on Archives. See #9015 git-svn-id: http://svn.automattic.com/wordpress/trunk@13147 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-content/themes/twentyten/attachment.php | 2 +- wp-content/themes/twentyten/author.php | 2 +- wp-content/themes/twentyten/functions.php | 60 ++++++++++------------ wp-content/themes/twentyten/loop.php | 24 ++++++--- wp-content/themes/twentyten/single.php | 4 +- 5 files changed, 49 insertions(+), 43 deletions(-) diff --git a/wp-content/themes/twentyten/attachment.php b/wp-content/themes/twentyten/attachment.php index 2989874f14..4d9d5fc9db 100644 --- a/wp-content/themes/twentyten/attachment.php +++ b/wp-content/themes/twentyten/attachment.php @@ -12,7 +12,7 @@
- + diff --git a/wp-content/themes/twentyten/author.php b/wp-content/themes/twentyten/author.php index e1ccd0c7ae..eb744d8fd9 100644 --- a/wp-content/themes/twentyten/author.php +++ b/wp-content/themes/twentyten/author.php @@ -5,7 +5,7 @@ -

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

+

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

diff --git a/wp-content/themes/twentyten/functions.php b/wp-content/themes/twentyten/functions.php index 4f915728b9..7708b22131 100644 --- a/wp-content/themes/twentyten/functions.php +++ b/wp-content/themes/twentyten/functions.php @@ -118,41 +118,37 @@ function twentyten_remove_gallery_css() { } add_filter( 'gallery_style', 'twentyten_remove_gallery_css' ); - -// For category lists on category archives: Returns other categories except the current one (redundant) -function cats_meow( $glue ) { - $current_cat = single_cat_title( '', false ); - $separator = "\n"; - $cats = explode( $separator, get_the_category_list($separator) ); - foreach ( $cats as $i => $str ) { - if ( strstr( $str, ">$current_cat<" ) ) { - unset( $cats[$i] ); - break; +function twentyten_cat_list() { + return twentyten_term_list('category', ', ', __('Posted in %s', 'twentyten'), __('Also posted in %s', 'twentyten') ); +} +function twentyten_tag_list() { + return twentyten_term_list('post_tag', ', ', __('Tagged %s', 'twentyten'), __('Also tagged %s', 'twentyten') ); +} +function twentyten_term_list($taxonomy, $glue = ', ', $text = '', $also_text = '') { + global $wp_query, $post; + $current_term = $wp_query->queried_object; + $terms = wp_get_object_terms($post->ID, $taxonomy); + // If we're viewing a Taxonomy page.. + if ( isset($current_term->taxonomy) && $taxonomy == $current_term->taxonomy ) { + // Remove the term from display. + foreach ( (array)$terms as $key => $term ) { + if ( $term->term_id == $current_term->term_id ) { + unset($terms[$key]); + break; + } } + // Change to Also text as we've now removed something from the terms list. + $text = $also_text; } - if ( empty($cats) ) - return false; - - return trim( join( $glue, $cats ) ); -} // end cats_meow - - -// For tag lists on tag archives: Returns other tags except the current one (redundant) -function tag_ur_it( $glue ) { - $current_tag = single_tag_title( '', '', false ); - $separator = "\n"; - $tags = explode( $separator, get_the_tag_list( "", "$separator", "" ) ); - foreach ( $tags as $i => $str ) { - if ( strstr( $str, ">$current_tag<" ) ) { - unset( $tags[$i] ); - break; - } + $tlist = array(); + $rel = 'category' == $taxonomy ? 'rel="category"' : 'rel="tag"'; + foreach ( (array)$terms as $term ) { + $tlist[] = '' . $term->name . ''; } - if ( empty($tags) ) - return false; - - return trim( join( $glue, $tags ) ); -} // end tag_ur_it + if ( !empty($tlist) ) + return sprintf($text, join($glue, $tlist)); + return ''; +} // Register widgetized areas function twentyten_widgets_init() { diff --git a/wp-content/themes/twentyten/loop.php b/wp-content/themes/twentyten/loop.php index 7d58d74f0e..70b3cf4353 100644 --- a/wp-content/themes/twentyten/loop.php +++ b/wp-content/themes/twentyten/loop.php @@ -14,7 +14,7 @@ - +
@@ -46,16 +46,22 @@
> + +
+ →', 'twentyten' ) ); ?> +
+
→', 'twentyten' ) ); ?>
+
- - + + |\n\t\t\t\t\t\t", "\n\t\t\t\t\t\n" ); ?>
@@ -71,7 +77,7 @@ - +
@@ -86,9 +92,13 @@ the_permalink(); ?>" title="" rel="bookmark"> - - - ' . __('Tagged ', 'twentyten' ) . '', ", ", "\n\t\t\t\t\t\t|\n" ); ?> + + + + + + + |\n\t\t\t\t\t\t", "\n\t\t\t\t\t\n" ); ?>
diff --git a/wp-content/themes/twentyten/single.php b/wp-content/themes/twentyten/single.php index cecff1113c..368bf0b5e4 100644 --- a/wp-content/themes/twentyten/single.php +++ b/wp-content/themes/twentyten/single.php @@ -15,7 +15,7 @@