Make WordPress Core


Ignore:
Timestamp:
08/30/2012 04:59:22 PM (13 years ago)
Author:
lancewillett
Message:

Twenty Twelve: move Open Sans custom font loading to a body class to allow easier overriding, fixes #21694.

  • Use wp_style_is() to check for the enqueued CSS file before adding the body class value.
  • Add a sample dequeue method in the comments as documentation for child themers and their ilk.

Props viniciusmassuchetto, nacin, and obenland.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentytwelve/functions.php

    r21643 r21668  
    103103    /*
    104104     * Loads our special font CSS file.
     105     *
     106     * To disable in a child theme, use wp_dequeue_style()
     107     * function mytheme_dequeue_fonts() {
     108     *     wp_dequeue_style( 'twentytwelve-fonts' );
     109     * }
     110     * add_action( 'wp_enqueue_scripts', 'mytheme_dequeue_fonts', 11 );
    105111     */
    106112    $protocol = is_ssl() ? 'https' : 'http';
     
    377383        $classes[] = 'custom-background-white';
    378384
     385    // Enable custom font class only if the font CSS is queued to load.
     386    if ( wp_style_is( 'twentytwelve-fonts', 'queue' ) )
     387        $classes[] = 'custom-font-enabled';
     388
    379389    return $classes;
    380390}
Note: See TracChangeset for help on using the changeset viewer.