Make WordPress Core


Ignore:
Timestamp:
06/10/2011 09:57:18 PM (14 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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' );
Note: See TracChangeset for help on using the changeset viewer.