WordPress.org

Make WordPress Core

Ticket #21694: opensans.diff

File opensans.diff, 1.4 KB (added by viniciusmassuchetto, 6 years ago)

Adds an 'enable-font' class to the body when using Open Sans font option.

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

     
    434434body {
    435435        font-size: 14px;
    436436        font-size: 1rem;
    437         font-family: "Open Sans", Helvetica, Arial, sans-serif;
     437        font-family: Helvetica, Arial, sans-serif;
    438438        text-rendering: optimizeLegibility;
    439439        color: #444;
    440440}
     441body.enable-fonts {
     442        font-family: "Open Sans", Helvetica, Arial, sans-serif;
     443}
    441444a {
    442445        outline: none;
    443446        color: #21759b;
  • wp-content/themes/twentytwelve/functions.php

     
    370370 * @return array Filtered class values.
    371371 */
    372372function twentytwelve_body_class( $classes ) {
     373        global $twentytwelve_options;
    373374        $background_color = get_background_color();
    374375
    375376        if ( ! is_active_sidebar( 1 ) || is_page_template( 'full-width-page.php' ) )
     
    383384        elseif ( in_array( $background_color, array( 'fff', 'ffffff' ) ) )
    384385                $classes[] = 'custom-background-white';
    385386
     387        $options = $twentytwelve_options->get_theme_options();
     388        if ( $options['enable_fonts'] )
     389                $classes[] = 'enable-fonts';
     390
    386391        return $classes;
    387392}
    388393add_filter( 'body_class', 'twentytwelve_body_class' );