WordPress.org

Make WordPress Core

Ticket #21399: 21399.3.diff

File 21399.3.diff, 1.1 KB (added by obenland, 9 years ago)

Version check with is_ssl() as fallback

  • wp-content/themes/twentytwelve/functions.php

     
    112112         * Depends on Theme Options setting.
    113113         */
    114114        $options = $twentytwelve_options->get_theme_options();
    115         if ( $options['enable_fonts'] )
    116                 wp_enqueue_style( 'twentytwelve-fonts', 'http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700' );
     115        if ( $options['enable_fonts'] ) {
    117116
     117                /**
     118                 * From 3.5 forward, protocol-relative URLs are allowed when
     119                 * registering/enqueueing scripts and styles.
     120                 */
     121                if ( version_compare( get_bloginfo( 'version' ), '3.5', '>=' ) ) {
     122                        wp_enqueue_style( 'twentytwelve-fonts', '//fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700' );
     123                } else {
     124                        $protocol = is_ssl() ? 'https' : 'http';
     125                        wp_enqueue_style( 'twentytwelve-fonts', "$protocol://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700" );
     126                }
     127        }
     128       
    118129        /**
    119130         * Load our main CSS file.
    120131         */