Twenty Seventeen: Fix playlists not rendering on blog/archive pages when using video or audio post format

TwentySeventeen attempts to highlight media found in post content by using `get_media_embedded_in_content()` to extract videos from the content and display their HTML differently. However, the HTML being generated by the playlist shortcode relies on JavaScript to update the video element with the markup needed to display the playlist properly. The `get_media_embedded_in_content()` function wasn't designed to handle this use case.

The patch looks for the presence of `wp-playlist-script` in the content and shows the standard content rather than trying to pluck the media elements from the content using `get_media_embedded_in_content()`.

Props joemcgill.

Fixes #38390.

Built from https://develop.svn.wordpress.org/trunk@39146


git-svn-id: http://core.svn.wordpress.org/trunk@39086 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
David A. Kennedy 2016-11-05 00:45:31 +00:00
parent 9f288ff12a
commit 4c5f80c839
3 changed files with 14 additions and 3 deletions

View File

@ -41,7 +41,13 @@
<?php
$content = apply_filters( 'the_content', get_the_content() );
$audio = get_media_embedded_in_content( $content, array( 'audio' ) );
$audio = false;
// Only get audio from the content if a playlist isn't present.
if ( false === strpos( $content, 'wp-playlist-script' ) ) {
$audio = get_media_embedded_in_content( $content, array( 'audio' ) );
}
?>
<?php if ( '' !== get_the_post_thumbnail() && ! is_single() ) : ?>

View File

@ -40,7 +40,12 @@
<?php
$content = apply_filters( 'the_content', get_the_content() );
$video = get_media_embedded_in_content( $content, array( 'video', 'object', 'embed', 'iframe' ) );
$video = false;
// Only get video from the content if a playlist isn't present.
if ( false === strpos( $content, 'wp-playlist-script' ) ) {
$video = get_media_embedded_in_content( $content, array( 'video', 'object', 'embed', 'iframe' ) );
}
?>
<?php if ( '' !== get_the_post_thumbnail() && ! is_single() && empty( $video ) ) : ?>

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.7-beta2-39145';
$wp_version = '4.7-beta2-39146';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.