Make WordPress Core


Ignore:
Timestamp:
05/10/2010 07:06:22 PM (15 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/functions.php

    r14534 r14541  
    412412        return get_permalink( $post->post_parent );
    413413}
     414
     415/**
     416 * Returns HTML with meta information for the current post—date/time and author.
     417 */
     418function twentyten_posted_on() {
     419    return sprintf( __( '<span %1$s>Posted on</span> %2$s by %3$s', 'twentyten' ),
     420        'class="meta-prep meta-prep-author"',
     421        sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a> <span class="meta-sep">',
     422            get_permalink(),
     423            esc_attr( get_the_time() ),
     424            get_the_date()
     425        ),
     426        sprintf( '</span> <span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
     427            get_author_posts_url( get_the_author_meta( 'ID' ) ),
     428            sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
     429            get_the_author()
     430        )
     431    );
     432   
     433}
     434
     435/**
     436 * Returns HTML with meta information for the current post—category, tags and permalink
     437 */
     438
     439function twentyten_posted_in() {
     440    $tag_list = get_the_tag_list();
     441    if ( $tag_list ) {
     442        $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' );
     443    } else {
     444        $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' );
     445    }
     446    return sprintf(
     447        $utility_text,
     448        get_the_category_list( ', ' ),
     449        $tag_list,
     450        get_permalink(),
     451        the_title_attribute( 'echo=0' ),
     452        get_post_comments_feed_link()
     453    ); 
     454}
Note: See TracChangeset for help on using the changeset viewer.