Make WordPress Core

Ticket #21759: 21579.diff

File 21579.diff, 2.0 KB (added by iamtakashi, 12 years ago)

Hiding author name on a single-author blog with CSS.

  • wp-content/themes/twentytwelve/style.css

     
    881881        line-height: 1.846153846;
    882882        color: #777;
    883883}
     884.single-author .entry-meta .by-author {
     885        display: none;
     886}
    884887
    885888
    886889/* =Archives
  • wp-content/themes/twentytwelve/functions.php

     
    336336
    337337        // Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name.
    338338        if ( $tag_list ) {
    339                 $utility_text = __( 'This entry was posted in %1$s and tagged %2$s on %3$s by %4$s.', 'twentytwelve' );
     339                $utility_text = __( 'This entry was posted in %1$s and tagged %2$s on %3$s<span class="by-author"> by %4$s</span>.', 'twentytwelve' );
    340340        } elseif ( $categories_list ) {
    341                 $utility_text = __( 'This entry was posted in %1$s on %3$s by %4$s.', 'twentytwelve' );
     341                $utility_text = __( 'This entry was posted in %1$s on %3$s<span class="by-author"> by %4$s</span>.', 'twentytwelve' );
    342342        } else {
    343                 $utility_text = __( 'This entry was posted on %3$s by %4$s.', 'twentytwelve' );
     343                $utility_text = __( 'This entry was posted on %3$s<span class="by-author"> by %4$s</span>.', 'twentytwelve' );
    344344        }
    345345
    346346        printf(
     
    354354endif;
    355355
    356356/**
     357 * Adds a classe to the array of body classes.
     358 * If the site has only one author with published posts.
     359 *
     360 * @since Twenty Twelve 1.0
     361 */
     362function twentytwelve_body_classes( $classes ) {
     363
     364        if ( function_exists( 'is_multi_author' ) && ! is_multi_author() )
     365                $classes[] = 'single-author';
     366
     367        return $classes;
     368}
     369add_filter( 'body_class', 'twentytwelve_body_classes' );
     370
     371/**
    357372 * Extends the default WordPress body class to denote:
    358373 * 1. Using a full-width layout, when no active widgets in the sidebar
    359374 *    or full-width template.