WordPress.org

Making WordPress.org

Ticket #3569: 3569.diff

File 3569.diff, 1.8 KB (added by dimadin, 23 months ago)
  • functions.php

     
    3030}
    3131
    3232/**
     33 * Register custom fonts.
     34 */
     35function fonts_url() {
     36        $fonts_url = '';
     37        $fonts     = array();
     38        $subsets   = 'cyrillic,cyrillic-ext,greek,greek-ext,latin,latin-ext,vietnamese';
     39
     40        /*
     41         * Translators: If there are characters in your language that are not supported
     42         * by Source Sans Pro, translate this to 'off'. Do not translate into your own language.
     43         */
     44        if ( 'off' !== _x( 'on', 'Source Sans Pro font: on or off', 'wp15' ) ) {
     45                $fonts[] = 'Source Sans Pro:400,400i,600,700';
     46        }
     47
     48        /*
     49         * Translators: If there are characters in your language that are not supported
     50         * by Crete Round, translate this to 'off'. Do not translate into your own language.
     51         */
     52        if ( 'off' !== _x( 'on', 'Crete Round font: on or off', 'wp15' ) ) {
     53                $fonts[] = 'Crete Round';
     54        }
     55
     56        if ( $fonts ) {
     57                $fonts_url = add_query_arg( array(
     58                        'family' => urlencode( implode( '|', $fonts ) ),
     59                        'subset' => urlencode( $subsets ),
     60                ), 'https://fonts.googleapis.com/css' );
     61        }
     62
     63        return $fonts_url;
     64}
     65
     66/**
    3367 * Enqueue scripts and styles
    3468 */
    3569function enqueue_scripts() {
    3670        wp_register_style(
    37                 'source-sans-pro',
    38                 'https://fonts.googleapis.com/css?family=Crete+Round|Source+Sans+Pro:400,400i,600,700&subset=cyrillic,cyrillic-ext,greek,greek-ext,latin-ext,vietnamese'
     71                'twentyseventeen-wp15-fonts',
     72                fonts_url()
    3973        );
    4074
    4175        wp_register_style(
     
    4680        wp_enqueue_style(
    4781                'twentyseventeen-style',
    4882                get_stylesheet_directory_uri() . '/style.css',
    49                 array( 'twentyseventeen-parent-style', 'source-sans-pro', 'dashicons' ),
     83                array( 'twentyseventeen-parent-style', 'twentyseventeen-wp15-fonts', 'dashicons' ),
    5084                filemtime( __DIR__ . '/style.css' )
    5185        );
    5286