WordPress.org

Make WordPress Core

Changeset 18244


Ignore:
Timestamp:
06/10/2011 09:57:18 PM (7 years ago)
Author:
nacin
Message:

Twenty Eleven: escaping frenzy, hide authors if a single author blog. props DH-Shredder, props iandstewart, see #17385, fixes #17563.

Location:
trunk/wp-content/themes/twentyeleven
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentyeleven/author.php

    r17959 r18244  
    2525
    2626                <header class="page-header">
    27                     <h1 class="page-title author"><?php printf( __( 'Author Archives: %s', 'twentyeleven' ), '<span class="vcard"><a class="url fn n" href="' . get_author_posts_url( get_the_author_meta( "ID" ) ) . '" title="' . esc_attr( get_the_author() ) . '" rel="me">' . get_the_author() . '</a></span>' ); ?></h1>
     27                    <h1 class="page-title author"><?php printf( __( 'Author Archives: %s', 'twentyeleven' ), '<span class="vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( "ID" ) ) ) . '" title="' . esc_attr( get_the_author() ) . '" rel="me">' . get_the_author() . '</a></span>' ); ?></h1>
    2828                </header>
    2929
  • trunk/wp-content/themes/twentyeleven/content-aside.php

    r18189 r18244  
    4040
    4141        <footer class="entry-meta">
    42             <?php
    43                 printf( __( '<span class="sep">Posted on </span><a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s" pubdate>%3$s</time></a> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s" rel="author">%6$s</a></span>', 'twentyeleven' ),
    44                     get_permalink(),
    45                     get_the_date( 'c' ),
    46                     get_the_date(),
    47                     get_author_posts_url( get_the_author_meta( 'ID' ) ),
    48                     sprintf( esc_attr__( 'View all posts by %s', 'twentyeleven' ), get_the_author() ),
    49                     get_the_author()
    50                 );
    51             ?>
     42            <?php twentyeleven_posted_on(); ?>
    5243            <?php if ( comments_open() ) : ?>
    5344            <span class="sep"> | </span>
  • trunk/wp-content/themes/twentyeleven/content-featured.php

    r18189 r18244  
    1515
    1616        <div class="entry-meta">
    17             <?php
    18                 printf( __( '<span class="sep">Posted on </span><a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s" pubdate>%3$s</time></a> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s" rel="author">%6$s</a></span>', 'twentyeleven' ),
    19                     get_permalink(),
    20                     get_the_date( 'c' ),
    21                     get_the_date(),
    22                     get_author_posts_url( get_the_author_meta( 'ID' ) ),
    23                     sprintf( esc_attr__( 'View all posts by %s', 'twentyeleven' ), get_the_author() ),
    24                     get_the_author()
    25                 );
    26             ?>
     17            <?php twentyeleven_posted_on(); ?>
    2718        </div><!-- .entry-meta -->
    2819    </header><!-- .entry-header -->
     
    4738                get_the_category_list( __( ', ', 'twentyeleven' ) ),
    4839                $tag_list,
    49                 get_permalink(),
     40                esc_url( get_permalink() ),
    5041                the_title_attribute( 'echo=0' )
    5142            );
  • trunk/wp-content/themes/twentyeleven/content-gallery.php

    r18189 r18244  
    1919
    2020        <div class="entry-meta">
    21             <?php
    22                 printf( __( '<span class="sep">Posted on </span><a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s" pubdate>%3$s</time></a> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s" rel="author">%6$s</a></span>', 'twentyeleven' ),
    23                     get_permalink(),
    24                     get_the_date( 'c' ),
    25                     get_the_date(),
    26                     get_author_posts_url( get_the_author_meta( 'ID' ) ),
    27                     sprintf( esc_attr__( 'View all posts by %s', 'twentyeleven' ), get_the_author() ),
    28                     get_the_author()
    29                 );
    30             ?>
     21            <?php twentyeleven_posted_on(); ?>
    3122        </div><!-- .entry-meta -->
    3223    </header><!-- .entry-header -->
     
    5546
    5647                <p><em><?php printf( _n( 'This gallery contains <a %1$s>%2$s photo</a>.', 'This gallery contains <a %1$s>%2$s photos</a>.', $total_images, 'twentyeleven' ),
    57                         'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
     48                        'href="' . esc_url( get_permalink() ) . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
    5849                        number_format_i18n( $total_images )
    5950                    ); ?></em></p>
  • trunk/wp-content/themes/twentyeleven/content-image.php

    r18189 r18244  
    3333            <div class="entry-meta">
    3434                <?php
    35                     printf( __( '<a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s" pubdate>%3$s</time></a> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s" rel="author">%6$s</a></span>', 'twentyeleven' ),
    36                         get_permalink(),
     35                    printf( __( '<a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s" pubdate>%3$s</time></a></a><span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s" rel="author">%6$s</a></span></span>', 'twentyeleven' ),
     36                        esc_url( get_permalink() ),
    3737                        get_the_date( 'c' ),
    3838                        get_the_date(),
    39                         get_author_posts_url( get_the_author_meta( 'ID' ) ),
     39                        esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    4040                        sprintf( esc_attr__( 'View all posts by %s', 'twentyeleven' ), get_the_author() ),
    4141                        get_the_author()
  • trunk/wp-content/themes/twentyeleven/content-link.php

    r18189 r18244  
    4040
    4141        <footer class="entry-meta">
    42             <?php
    43                 printf( __( '<span class="sep">Posted on </span><a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s" pubdate>%3$s</time></a> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s" rel="author">%6$s</a></span>', 'twentyeleven' ),
    44                     get_permalink(),
    45                     get_the_date( 'c' ),
    46                     get_the_date(),
    47                     get_author_posts_url( get_the_author_meta( 'ID' ) ),
    48                     sprintf( esc_attr__( 'View all posts by %s', 'twentyeleven' ), get_the_author() ),
    49                     get_the_author()
    50                 );
    51             ?>
     42            <?php twentyeleven_posted_on(); ?>
    5243            <?php if ( comments_open() ) : ?>
    5344            <span class="sep"> | </span>
  • trunk/wp-content/themes/twentyeleven/content-quote.php

    r18189 r18244  
    1818            <?php if ( 'post' == $post->post_type ) : ?>
    1919            <div class="entry-meta">
    20                 <?php
    21                     printf( __( '<span class="sep">Posted on </span><a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s" pubdate>%3$s</time></a> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s" rel="author">%6$s</a></span>', 'twentyeleven' ),
    22                         get_permalink(),
    23                         get_the_date( 'c' ),
    24                         get_the_date(),
    25                         get_author_posts_url( get_the_author_meta( 'ID' ) ),
    26                         sprintf( esc_attr__( 'View all posts by %s', 'twentyeleven' ), get_the_author() ),
    27                         get_the_author()
    28                     );
    29                 ?>
     20                <?php twentyeleven_posted_on(); ?>
    3021            </div><!-- .entry-meta -->
    3122            <?php endif; ?>
  • trunk/wp-content/themes/twentyeleven/content-single.php

    r18189 r18244  
    1414
    1515        <div class="entry-meta">
    16             <?php
    17                 printf( __( '<span class="sep">Posted on </span><a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s" pubdate>%3$s</time></a> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s" rel="author">%6$s</a></span>', 'twentyeleven' ),
    18                     get_permalink(),
    19                     get_the_date( 'c' ),
    20                     get_the_date(),
    21                     get_author_posts_url( get_the_author_meta( 'ID' ) ),
    22                     sprintf( esc_attr__( 'View all posts by %s', 'twentyeleven' ), get_the_author() ),
    23                     get_the_author()
    24                 );
    25             ?>
     16            <?php twentyeleven_posted_on(); ?>
    2617        </div><!-- .entry-meta -->
    2718    </header><!-- .entry-header -->
     
    4637                get_the_category_list( __( ', ', 'twentyeleven' ) ),
    4738                $tag_list,
    48                 get_permalink(),
     39                esc_url( get_permalink() ),
    4940                the_title_attribute( 'echo=0' ),
    5041                get_the_author(),
    51                 get_author_posts_url( get_the_author_meta( 'ID' ) )
     42                esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) )
    5243            );
    5344        ?>
     
    6354                <?php the_author_meta( 'description' ); ?>
    6455                <div id="author-link">
    65                     <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>" rel="author">
     56                    <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">
    6657                        <?php printf( __( 'View all posts by %s <span class="meta-nav">&rarr;</span>', 'twentyeleven' ), get_the_author() ); ?>
    6758                    </a>
  • trunk/wp-content/themes/twentyeleven/content-status.php

    r18189 r18244  
    4141
    4242        <footer class="entry-meta">
    43             <?php
    44                 printf( __( '<span class="sep">Posted on </span><a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s" pubdate>%3$s</time></a> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s" rel="author">%6$s</a></span>', 'twentyeleven' ),
    45                     get_permalink(),
    46                     get_the_date( 'c' ),
    47                     get_the_date(),
    48                     get_author_posts_url( get_the_author_meta( 'ID' ) ),
    49                     sprintf( esc_attr__( 'View all posts by %s', 'twentyeleven' ), get_the_author() ),
    50                     get_the_author()
    51                 );
    52             ?>
     43            <?php twentyeleven_posted_on(); ?>
    5344            <?php if ( comments_open() ) : ?>
    5445            <span class="sep"> | </span>
  • trunk/wp-content/themes/twentyeleven/content.php

    r18189 r18244  
    2222            <?php if ( 'post' == $post->post_type ) : ?>
    2323            <div class="entry-meta">
    24                 <?php
    25                     printf( __( '<span class="sep">Posted on </span><a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s" pubdate>%3$s</time></a> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s" rel="author">%6$s</a></span>', 'twentyeleven' ),
    26                         get_permalink(),
    27                         get_the_date( 'c' ),
    28                         get_the_date(),
    29                         get_author_posts_url( get_the_author_meta( 'ID' ) ),
    30                         sprintf( esc_attr__( 'View all posts by %s', 'twentyeleven' ), get_the_author() ),
    31                         get_the_author()
    32                     );
    33                 ?>
     24                <?php twentyeleven_posted_on(); ?>
    3425            </div><!-- .entry-meta -->
    3526            <?php endif; ?>
  • trunk/wp-content/themes/twentyeleven/functions.php

    r18140 r18244  
    301301            $style = ' style="color:#' . get_theme_mod( 'header_textcolor', HEADER_TEXTCOLOR ) . ';"';
    302302        ?>
    303         <h1><a id="name"<?php echo $style; ?> onclick="return false;" href="<?php echo home_url( '/' ); ?>"><?php bloginfo( 'name' ); ?></a></h1>
     303        <h1><a id="name"<?php echo $style; ?> onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a></h1>
    304304        <div id="desc"<?php echo $style; ?>><?php bloginfo( 'description' ); ?></div>
    305305        <?php $header_image = get_header_image();
     
    326326 */
    327327function twentyeleven_continue_reading_link() {
    328     return ' <a href="'. get_permalink() . '">' . __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) . '</a>';
     328    return ' <a href="'. esc_url( get_permalink() ) . '">' . __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) . '</a>';
    329329}
    330330
     
    560560}
    561561endif; // ends check for twentyeleven_comment()
     562
     563if ( ! function_exists( 'twentyeleven_posted_on' ) ) :
     564/**
     565 * Prints HTML with meta information for the current post-date/time and author.
     566 *
     567 * @since Twenty Eleven 1.0
     568 */
     569function twentyeleven_posted_on() {
     570    printf( __( '<span class="sep">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></a><span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'twentyeleven' ),
     571        esc_url( get_permalink() ),
     572        esc_attr( get_the_time() ),
     573        esc_attr( get_the_date( 'c' ) ),
     574        esc_html( get_the_date() ),
     575        esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
     576        sprintf( esc_attr__( 'View all posts by %s', 'twentyeleven' ), get_the_author() ),
     577        esc_html( get_the_author() )
     578    );
     579}
     580endif;
     581
     582/**
     583 * Adds Twenty Eleven author class to the array of body classes.
     584 *
     585 * @since Twenty Eleven 1.0
     586 */
     587function twentyeleven_author_class( $classes ) {
     588
     589    if ( ! is_multi_author() ) {
     590        $classes[] = 'single-author';
     591    }
     592   
     593    return $classes;
     594}
     595add_filter( 'body_class', 'twentyeleven_author_class' );
  • trunk/wp-content/themes/twentyeleven/header.php

    r18181 r18244  
    7272    <header id="branding" role="banner">
    7373            <hgroup>
    74                 <h1 id="site-title"><span><a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></span></h1>
     74                <h1 id="site-title"><span><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></span></h1>
    7575                <h2 id="site-description"><?php bloginfo( 'description' ); ?></h2>
    7676            </hgroup>
     
    8181                if ( ! empty( $header_image ) ) :
    8282            ?>
    83             <a href="<?php echo home_url( '/' ); ?>">
     83            <a href="<?php echo esc_url( home_url( '/' ) ); ?>">
    8484                <?php
    8585                    // The header image
  • trunk/wp-content/themes/twentyeleven/image.php

    r18072 r18244  
    3030                                    esc_attr( get_the_time() ),
    3131                                    get_the_date(),
    32                                     wp_get_attachment_url(),
     32                                    esc_url( wp_get_attachment_url() ),
    3333                                    $metadata['width'],
    3434                                    $metadata['height'],
    35                                     get_permalink( $post->post_parent ),
     35                                    esc_url( get_permalink( $post->post_parent ) ),
    3636                                    get_the_title( $post->post_parent )
    3737                                );
     
    7070    }
    7171?>
    72                                 <a href="<?php echo $next_attachment_url; ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php
     72                                <a href="<?php echo esc_url( $next_attachment_url ); ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php
    7373                                $attachment_size = apply_filters( 'twentyeleven_attachment_size', 848 );
    7474                                echo wp_get_attachment_image( $post->ID, array( $attachment_size, 1024 ) ); // filterable image width with 1024px limit for image height.
     
    9393                    <footer class="entry-meta">
    9494                        <?php if ( comments_open() && pings_open() ) : // Comments and trackbacks open ?>
    95                             <?php printf( __( '<a class="comment-link" href="#respond" title="Post a comment">Post a comment</a> or leave a trackback: <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">Trackback URL</a>.', 'twentyeleven' ), get_trackback_url() ); ?>
     95                            <?php printf( __( '<a class="comment-link" href="#respond" title="Post a comment">Post a comment</a> or leave a trackback: <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">Trackback URL</a>.', 'twentyeleven' ), esc_url( get_trackback_url() ) ); ?>
    9696                        <?php elseif ( ! comments_open() && pings_open() ) : // Only trackbacks open ?>
    97                             <?php printf( __( 'Comments are closed, but you can leave a trackback: <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">Trackback URL</a>.', 'twentyeleven' ), get_trackback_url() ); ?>
     97                            <?php printf( __( 'Comments are closed, but you can leave a trackback: <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">Trackback URL</a>.', 'twentyeleven' ), esc_url( get_trackback_url() ) ); ?>
    9898                        <?php elseif ( comments_open() && ! pings_open() ) : // Only comments open ?>
    9999                            <?php _e( 'Trackbacks are closed, but you can <a class="comment-link" href="#respond" title="Post a comment">post a comment</a>.', 'twentyeleven' ); ?>
  • trunk/wp-content/themes/twentyeleven/searchform.php

    r18166 r18244  
    88 */
    99?>
    10     <form method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
     10    <form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
    1111        <label for="s" class="assistive-text"><?php _e( 'Search', 'twentyeleven' ); ?></label>
    1212        <input type="text" class="field" name="s" id="s" placeholder="<?php esc_attr_e( 'Search', 'twentyeleven' ); ?>" />
  • trunk/wp-content/themes/twentyeleven/style.css

    r18190 r18244  
    738738.entry-meta a {
    739739    font-weight: bold;
     740}
     741.single-author .entry-meta .by-author {
     742    display: none;
    740743}
    741744.entry-content,
Note: See TracChangeset for help on using the changeset viewer.