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. git-svn-id: https://develop.svn.wordpress.org/trunk@39146 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
5d832bc2ae
commit
d93ca46c4f
@ -41,7 +41,13 @@
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
$content = apply_filters( 'the_content', get_the_content() );
|
$content = apply_filters( 'the_content', get_the_content() );
|
||||||
|
$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' ) );
|
$audio = get_media_embedded_in_content( $content, array( 'audio' ) );
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php if ( '' !== get_the_post_thumbnail() && ! is_single() ) : ?>
|
<?php if ( '' !== get_the_post_thumbnail() && ! is_single() ) : ?>
|
||||||
|
@ -40,7 +40,12 @@
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
$content = apply_filters( 'the_content', get_the_content() );
|
$content = apply_filters( 'the_content', get_the_content() );
|
||||||
|
$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' ) );
|
$video = get_media_embedded_in_content( $content, array( 'video', 'object', 'embed', 'iframe' ) );
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php if ( '' !== get_the_post_thumbnail() && ! is_single() && empty( $video ) ) : ?>
|
<?php if ( '' !== get_the_post_thumbnail() && ! is_single() && empty( $video ) ) : ?>
|
||||||
|
Loading…
Reference in New Issue
Block a user