WordPress.org

Make WordPress Core

Ticket #21751: 21751.open-sans-subsets.diff

File 21751.open-sans-subsets.diff, 1.7 KB (added by obenland, 6 years ago)
  • wp-content/themes/twentytwelve/functions.php

     
    115115        /* translators: If there are characters in your language that are not supported by Open Sans,
    116116           enter 'disable-open-sans'. Otherwise enter 'enable-open-sans'. Do not translate into your own language. */
    117117        if ( false === strpos( _x( 'enable-open-sans', 'Open Sans font: enable or disable', 'twentytwelve' ), 'disable' ) ) {
     118
     119                $subsets = 'latin,latin-ext';
     120                /* translators: To add an additional Open Sans character subset specific to your language enter 'greek', 'cyrillic' or 'vietnamese'.
     121                   Otherwise enter 'open-sans-subset'. Do not translate into your own language. */
     122                $add_subset = _x( 'open-sans-subset', 'Additional Open Sans font subset: greek, cyrillic or vietnamese', 'twentytwelve' );
     123
     124                if ( in_array( $add_subset, array( 'greek', 'cyrillic', 'vietnamese' ) ) ) {
     125                        $character_sets = array(
     126                                'greek'      => 'greek,greek-ext',
     127                                'cyrillic'   => 'cyrillic,cyrillic-ext',
     128                                'vietnamese' => 'vietnamese'
     129                        );
     130                        $subsets = implode( ',', array( $subsets, $character_sets[ $add_subset ] ) );
     131                }
     132
    118133                $protocol = is_ssl() ? 'https' : 'http';
    119                 wp_enqueue_style( 'twentytwelve-fonts', "$protocol://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700", array(), null );
     134                $query_args = array(
     135                        'family' => 'Open+Sans:400italic,700italic,400,700',
     136                        'subset' => $subsets
     137                );
     138                wp_enqueue_style( 'twentytwelve-fonts', add_query_arg( $query_args, "$protocol://fonts.googleapis.com/css" ), array(), null );
    120139        }
    121140
    122141        /*