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
This commit is contained in:
parent
eac401c171
commit
691bbab34d
|
@ -80,22 +80,7 @@
|
|||
</div><!-- .entry-content -->
|
||||
|
||||
<div class="entry-utility">
|
||||
<?php
|
||||
$tag_list = get_the_tag_list();
|
||||
if ( $tag_list ) {
|
||||
$utility_text = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
|
||||
} else {
|
||||
$utility_text = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
|
||||
}
|
||||
printf(
|
||||
$utility_text,
|
||||
get_the_category_list( ', ' ),
|
||||
$tag_list,
|
||||
get_permalink(),
|
||||
the_title_attribute( 'echo=0' ),
|
||||
get_post_comments_feed_link()
|
||||
);
|
||||
?>
|
||||
<?php echo twentyten_posted_in(); ?>
|
||||
<?php edit_post_link( __( 'Edit', 'twentyten' ), ' <span class="edit-link">', '</span>' ); ?>
|
||||
</div><!-- .entry-utility -->
|
||||
</div><!-- #post-<?php the_ID(); ?> -->
|
||||
|
|
|
@ -411,3 +411,44 @@ function twentyten_get_next_attachment_url() {
|
|||
else
|
||||
return get_permalink( $post->post_parent );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns HTML with meta information for the current post—date/time and author.
|
||||
*/
|
||||
function twentyten_posted_on() {
|
||||
return sprintf( __( '<span %1$s>Posted on</span> %2$s by %3$s', 'twentyten' ),
|
||||
'class="meta-prep meta-prep-author"',
|
||||
sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a> <span class="meta-sep">',
|
||||
get_permalink(),
|
||||
esc_attr( get_the_time() ),
|
||||
get_the_date()
|
||||
),
|
||||
sprintf( '</span> <span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
|
||||
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 <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
|
||||
} else {
|
||||
$utility_text = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
|
||||
}
|
||||
return sprintf(
|
||||
$utility_text,
|
||||
get_the_category_list( ', ' ),
|
||||
$tag_list,
|
||||
get_permalink(),
|
||||
the_title_attribute( 'echo=0' ),
|
||||
get_post_comments_feed_link()
|
||||
);
|
||||
}
|
||||
|
|
|
@ -41,26 +41,18 @@
|
|||
<h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
|
||||
|
||||
<div class="entry-meta">
|
||||
<?php
|
||||
printf( __( '<span class="meta-prep meta-prep-author">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a> <span class="meta-sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s">%6$s</a></span>', '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()
|
||||
);
|
||||
?>
|
||||
<?php echo twentyten_posted_on(); ?>
|
||||
</div><!-- .entry-meta -->
|
||||
|
||||
<div class="entry-content">
|
||||
<div class="gallery-thumb">
|
||||
<a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php
|
||||
<?php
|
||||
$images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
|
||||
$total_images = count( $images );
|
||||
$image = array_shift( $images );
|
||||
echo wp_get_attachment_image( $image->ID, 'thumbnail' );
|
||||
?></a>
|
||||
$image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
|
||||
?>
|
||||
<a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
|
||||
</div>
|
||||
<p><em><?php printf( __( 'This gallery contains <a %1$s>%2$s photos</a>.', 'twentyten' ),
|
||||
'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
|
||||
|
@ -92,16 +84,7 @@
|
|||
<?php endif; ?>
|
||||
|
||||
<div class="entry-utility">
|
||||
<?php
|
||||
printf( __( '<span class="meta-prep meta-prep-author">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a> <span class="meta-sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s">%6$s</a></span>', '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()
|
||||
);
|
||||
?>
|
||||
<?php echo twentyten_posted_on(); ?>
|
||||
<span class="meta-sep">|</span>
|
||||
<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
|
||||
<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
|
||||
|
@ -114,16 +97,7 @@
|
|||
<h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
|
||||
|
||||
<div class="entry-meta">
|
||||
<?php
|
||||
printf( __( '<span class="meta-prep meta-prep-author">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a> <span class="meta-sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s">%6$s</a></span>', '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()
|
||||
);
|
||||
?>
|
||||
<?php echo twentyten_posted_on(); ?>
|
||||
</div><!-- .entry-meta -->
|
||||
|
||||
<?php if ( is_archive() || is_search() ) : // Only display Excerpts for archives & search ?>
|
||||
|
@ -138,7 +112,12 @@
|
|||
<?php endif; ?>
|
||||
|
||||
<div class="entry-utility">
|
||||
<span class="cat-links"><span class="entry-utility-prep entry-utility-prep-cat-links"><?php _e( 'Posted in ', 'twentyten' ); ?></span><?php the_category( ', ' ); ?></span>
|
||||
<span class="cat-links">
|
||||
<span class="entry-utility-prep entry-utility-prep-cat-links">
|
||||
<?php
|
||||
printf( __('Posted in %s', 'twentyten' ), '</span> '.get_the_category_list( ', ' ) );
|
||||
?>
|
||||
</span>
|
||||
<span class="meta-sep">|</span>
|
||||
<?php the_tags( '<span class="tag-links"><span class="entry-utility-prep entry-utility-prep-tag-links">' . __( 'Tagged ', 'twentyten' ) . '</span>', ', ', '<span class="meta-sep">|</span>' ); ?>
|
||||
<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
|
||||
|
|
|
@ -24,10 +24,7 @@
|
|||
<h1 class="entry-title"><?php the_title(); ?></h1>
|
||||
|
||||
<div class="entry-meta">
|
||||
<span class="meta-prep meta-prep-author"><?php _e( 'Posted on ', 'twentyten' ); ?></span>
|
||||
<a href="<?php the_permalink(); ?>" title="<?php the_time(); ?>" rel="bookmark"><span class="entry-date"><?php echo get_the_date(); ?></span></a>
|
||||
<span class="meta-sep"><?php _e( ' by ', 'twentyten' ); ?></span>
|
||||
<span class="author vcard"><a class="url fn n" href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>" title="<?php printf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ); ?>"><?php the_author(); ?></a></span>
|
||||
<?php echo twentyten_posted_on(); ?>
|
||||
</div><!-- .entry-meta -->
|
||||
|
||||
<div class="entry-content">
|
||||
|
@ -51,22 +48,7 @@
|
|||
<?php endif; ?>
|
||||
|
||||
<div class="entry-utility">
|
||||
<?php
|
||||
$tag_list = get_the_tag_list('', ', ');
|
||||
if ( '' != $tag_list ) {
|
||||
$utility_text = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
|
||||
} else {
|
||||
$utility_text = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
|
||||
}
|
||||
printf(
|
||||
$utility_text,
|
||||
get_the_category_list( ', ' ),
|
||||
$tag_list,
|
||||
get_permalink(),
|
||||
the_title_attribute( 'echo=0' )
|
||||
);
|
||||
?>
|
||||
|
||||
<?php echo twentyten_posted_in(); ?>
|
||||
<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>
|
||||
</div><!-- .entry-utility -->
|
||||
</div><!-- #post-<?php the_ID(); ?> -->
|
||||
|
|
Loading…
Reference in New Issue