Make WordPress Core

Ticket #25899: 25899.diff

File 25899.diff, 2.0 KB (added by wonderboymusic, 11 years ago)
  • src/wp-includes/default-filters.php

     
    204204add_action( 'wp_head',             'locale_stylesheet'                      );
    205205add_action( 'publish_future_post', 'check_and_publish_future_post',   10, 1 );
    206206add_action( 'wp_head',             'noindex',                          1    );
     207add_action( 'wp_head',             'wp_enqueue_media_styles',          1    );
    207208add_action( 'wp_head',             'wp_print_styles',                  8    );
    208209add_action( 'wp_head',             'wp_print_head_scripts',            9    );
    209210add_action( 'wp_head',             'wp_generator'                           );
  • src/wp-includes/media.php

     
    18391839add_shortcode( 'video', 'wp_video_shortcode' );
    18401840
    18411841/**
     1842 * Conditionally enqueue media-related CSS in the <head>
     1843 *
     1844 */
     1845function wp_enqueue_media_styles() {
     1846        if ( ! have_posts() ) {
     1847                return;
     1848        }
     1849
     1850        global $wp_query;
     1851        foreach ( $wp_query->posts as $post ) {
     1852                if ( has_shortcode( $post->post_content, 'video' ) ) {
     1853                        $library = apply_filters( 'wp_video_shortcode_library', 'mediaelement' );
     1854                        if ( 'mediaelement' === $library && did_action( 'init' ) ) {
     1855                                wp_enqueue_style( 'wp-mediaelement' );
     1856                                break;
     1857                        }
     1858                }
     1859
     1860                if ( has_shortcode( $post->post_content, 'audio' ) ) {
     1861                        $library = apply_filters( 'wp_audio_shortcode_library', 'mediaelement' );
     1862                        if ( 'mediaelement' === $library && did_action( 'init' ) ) {
     1863                                wp_enqueue_style( 'wp-mediaelement' );
     1864                                break;
     1865                        }
     1866                }
     1867
     1868                if ( has_shortcode( $post->post_content, 'playlist' ) ) {
     1869                        wp_enqueue_style( 'wp-mediaelement' );
     1870                        break;
     1871                }
     1872        }
     1873}
     1874
     1875/**
    18421876 * Display previous image link that has the same post parent.
    18431877 *
    18441878 * @since 2.5.0