WordPress.org

Make WordPress Core

Ticket #30810: twentyfifteen-html5.js.patch

File twentyfifteen-html5.js.patch, 1.9 KB (added by grapplerulrich, 6 years ago)
  • trunk/src/wp-content/themes/twentyfifteen/functions.php

     
    231231                'expand'   => '<span class="screen-reader-text">' . __( 'expand child menu', 'twentyfifteen' ) . '</span>',
    232232                'collapse' => '<span class="screen-reader-text">' . __( 'collapse child menu', 'twentyfifteen' ) . '</span>',
    233233        ) );
     234
     235        wp_enqueue_script( 'twentyfifteen-html5shiv', get_template_directory_uri() . '/js/html5.js', array(), '3.7.0', false );
    234236}
    235237add_action( 'wp_enqueue_scripts', 'twentyfifteen_scripts' );
    236238
    237239/**
     240 * Enclose html5shiv in a IE condictional
     241 *
     242 * @since Twenty Fifteen 1.1
     243 */
     244function twentyfifteen_html5shiv( $tag, $handle, $src ) {
     245        if ( 'twentyfifteen-html5shiv' === $handle ) {
     246                $tag = "<!--[if lt IE 9]>\n";
     247                $tag .= "<script type='text/javascript' src='$src'></script>\n";
     248                $tag .= "<![endif]-->\n";
     249        }
     250        return $tag;
     251}
     252add_filter( 'script_loader_tag', 'twentyfifteen_html5shiv', 10, 3 );
     253
     254/**
    238255 * Add featured image as background image to post navigation elements.
    239256 *
    240257 * @since Twenty Fifteen 1.0
  • trunk/src/wp-content/themes/twentyfifteen/header.php

     
    1515        <meta name="viewport" content="width=device-width">
    1616        <link rel="profile" href="http://gmpg.org/xfn/11">
    1717        <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
    18         <!--[if lt IE 9]>
    19         <script src="<?php echo esc_url( get_template_directory_uri() ); ?>/js/html5.js"></script>
    20         <![endif]-->
    2118        <script>(function(){document.documentElement.className='js'})();</script>
    2219        <?php wp_head(); ?>
    2320</head>