Make WordPress Core


Ignore:
Timestamp:
05/10/2010 07:06:22 PM (16 years ago)
Author:
nbachiyski
Message:

Clean up loop i18n. Props zeo, see #13198

  • Take out tags from strings
  • Extract two common and complicatd strings into functions
  • Whitespace
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentyten/loop.php

    r14501 r14541  
    4242
    4343            <div class="entry-meta">
    44                 <?php
    45                     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' ),
    46                         get_permalink(),
    47                         esc_attr( get_the_time() ),
    48                         get_the_date(),
    49                         get_author_posts_url( get_the_author_meta( 'ID' ) ),
    50                         sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
    51                         get_the_author()
    52                     );
    53                 ?>
     44                <?php echo twentyten_posted_on(); ?>
    5445            </div><!-- .entry-meta -->
    5546
    5647            <div class="entry-content">
    5748                <div class="gallery-thumb">
    58                     <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php
    59                     $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
    60                     $total_images = count( $images );
    61                     $image = array_shift( $images );
    62                     echo wp_get_attachment_image( $image->ID, 'thumbnail' );
    63                     ?></a>
     49<?php
     50    $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
     51    $total_images = count( $images );
     52    $image = array_shift( $images );
     53    $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
     54?>
     55                    <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
    6456                </div>
    6557                <p><em><?php printf( __( 'This gallery contains <a %1$s>%2$s photos</a>.', 'twentyten' ),
     
    7365            <div class="entry-utility">
    7466                <a href="<?php echo get_term_link( _x('gallery', 'gallery category slug', 'twentyten'), 'category' ); ?>" title="<?php esc_attr_e( 'View posts in the Gallery category', 'twentyten' ); ?>"><?php _e( 'More Galleries', 'twentyten' ); ?></a>
    75                 <span class="meta-sep"> | </span>
     67                <span class="meta-sep">|</span>
    7668                <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
    7769                <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
     
    9385
    9486            <div class="entry-utility">
    95                 <?php
    96                     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' ),
    97                         get_permalink(),
    98                         esc_attr( get_the_time() ),
    99                         get_the_date(),
    100                         get_author_posts_url( get_the_author_meta( 'ID' ) ),
    101                         sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
    102                         get_the_author()
    103                     );
    104                 ?>
    105                 <span class="meta-sep"> | </span>
     87                <?php echo twentyten_posted_on(); ?>
     88                <span class="meta-sep">|</span>
    10689                <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
    10790                <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
     
    11598
    11699            <div class="entry-meta">
    117                 <?php
    118                     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' ),
    119                         get_permalink(),
    120                         esc_attr( get_the_time() ),
    121                         get_the_date(),
    122                         get_author_posts_url( get_the_author_meta( 'ID' ) ),
    123                         sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
    124                         get_the_author()
    125                     );
    126                 ?>
     100                <?php echo twentyten_posted_on(); ?>
    127101            </div><!-- .entry-meta -->
    128102
     
    139113
    140114            <div class="entry-utility">
    141                 <span class="cat-links"><span class="entry-utility-prep entry-utility-prep-cat-links"><?php _e( 'Posted in ', 'twentyten' ); ?></span><?php the_category( ', ' ); ?></span>
    142                 <span class="meta-sep"> | </span>
    143                 <?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>' ); ?>
     115                <span class="cat-links">
     116                    <span class="entry-utility-prep entry-utility-prep-cat-links">
     117                    <?php
     118                        printf( __('Posted in %s', 'twentyten' ), '</span> '.get_the_category_list( ', ' ) );
     119                    ?>                 
     120                </span>
     121                <span class="meta-sep">|</span>
     122                <?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>' ); ?>
    144123                <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
    145124                <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
Note: See TracChangeset for help on using the changeset viewer.