From 691bbab34da5facbb2b23aadd717d2bbc7c4da3b Mon Sep 17 00:00:00 2001 From: Nikolay Bachiyski Date: Mon, 10 May 2010 19:06:22 +0000 Subject: [PATCH] Clean up loop i18n. Props zeo, see #13198 * Take out tags from strings * Extract two common and complicatd strings into functions * Whitespace git-svn-id: https://develop.svn.wordpress.org/trunk@14541 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-content/themes/twentyten/attachment.php | 19 +------ wp-content/themes/twentyten/functions.php | 43 ++++++++++++++- wp-content/themes/twentyten/loop.php | 61 +++++++--------------- wp-content/themes/twentyten/single.php | 24 ++------- 4 files changed, 67 insertions(+), 80 deletions(-) diff --git a/wp-content/themes/twentyten/attachment.php b/wp-content/themes/twentyten/attachment.php index 7f17f2c3b9..59c09e4307 100644 --- a/wp-content/themes/twentyten/attachment.php +++ b/wp-content/themes/twentyten/attachment.php @@ -80,23 +80,8 @@
- permalink.', 'twentyten' ); - } else { - $utility_text = __( 'This entry was posted in %1$s. Bookmark the permalink.', 'twentyten' ); - } - printf( - $utility_text, - get_the_category_list( ', ' ), - $tag_list, - get_permalink(), - the_title_attribute( 'echo=0' ), - get_post_comments_feed_link() - ); - ?> -', '' ); ?> + + ', '' ); ?>
diff --git a/wp-content/themes/twentyten/functions.php b/wp-content/themes/twentyten/functions.php index 58bf9c7960..f77ad14f8f 100644 --- a/wp-content/themes/twentyten/functions.php +++ b/wp-content/themes/twentyten/functions.php @@ -410,4 +410,45 @@ function twentyten_get_next_attachment_url() { return get_attachment_link( $attachments[ $k ]->ID ); else return get_permalink( $post->post_parent ); -} \ No newline at end of file +} + +/** + * Returns HTML with meta information for the current post—date/time and author. + */ +function twentyten_posted_on() { + return sprintf( __( 'Posted on %2$s by %3$s', 'twentyten' ), + 'class="meta-prep meta-prep-author"', + sprintf( ' ', + get_permalink(), + esc_attr( get_the_time() ), + get_the_date() + ), + sprintf( ' %3$s', + get_author_posts_url( get_the_author_meta( 'ID' ) ), + sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ), + get_the_author() + ) + ); + +} + +/** + * Returns HTML with meta information for the current post—category, tags and permalink + */ + +function twentyten_posted_in() { + $tag_list = get_the_tag_list(); + if ( $tag_list ) { + $utility_text = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the permalink.', 'twentyten' ); + } else { + $utility_text = __( 'This entry was posted in %1$s. Bookmark the permalink.', 'twentyten' ); + } + return sprintf( + $utility_text, + get_the_category_list( ', ' ), + $tag_list, + get_permalink(), + the_title_attribute( 'echo=0' ), + get_post_comments_feed_link() + ); +} diff --git a/wp-content/themes/twentyten/loop.php b/wp-content/themes/twentyten/loop.php index 50df321742..3c8b1cf628 100644 --- a/wp-content/themes/twentyten/loop.php +++ b/wp-content/themes/twentyten/loop.php @@ -41,26 +41,18 @@

- Posted on by %6$s', 'twentyten' ), - get_permalink(), - esc_attr( get_the_time() ), - get_the_date(), - get_author_posts_url( get_the_author_meta( 'ID' ) ), - sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ), - get_the_author() - ); - ?> +

%2$s photos.', 'twentyten' ), 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"', @@ -72,7 +64,7 @@

- | + | | ', '' ); ?>
@@ -92,17 +84,8 @@
- Posted on by %6$s', 'twentyten' ), - get_permalink(), - esc_attr( get_the_time() ), - get_the_date(), - get_author_posts_url( get_the_author_meta( 'ID' ) ), - sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ), - get_the_author() - ); - ?> - | + + | | ', '' ); ?>
@@ -114,16 +97,7 @@

@@ -138,9 +112,14 @@
- - | - ' . __( 'Tagged ', 'twentyten' ) . '', ', ', ' | ' ); ?> + + + '.get_the_category_list( ', ' ) ); + ?> + + | + ' . __( 'Tagged ', 'twentyten' ) . '', ', ', '|' ); ?> | ', '' ); ?>
diff --git a/wp-content/themes/twentyten/single.php b/wp-content/themes/twentyten/single.php index 1097918b08..0ff069c902 100644 --- a/wp-content/themes/twentyten/single.php +++ b/wp-content/themes/twentyten/single.php @@ -24,10 +24,7 @@

@@ -51,23 +48,8 @@
- permalink.', 'twentyten' ); - } else { - $utility_text = __( 'This entry was posted in %1$s. Bookmark the permalink.', 'twentyten' ); - } - printf( - $utility_text, - get_the_category_list( ', ' ), - $tag_list, - get_permalink(), - the_title_attribute( 'echo=0' ) - ); - ?> - -', '' ); ?> + + ', '' ); ?>