如何从WordPress的帖子内容中删除嵌入式媒体内容

时间:2018-12-21 05:55:35

标签: wordpress post video types

我只想过滤出类型视频后的内容,我已经分离出嵌入式视频,现在我只想过滤出内容。

// 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' ) );
        }



        if (  is_single() ) {

            // If not a single post, highlight the video file.
            if ( ! empty( $video ) ) {
                echo '<div class="blog-img">';
                foreach ( $video as $video_html ) {
                    echo '<div class="entry-video">';
                        echo ($video_html);
                    echo '</div>';
                }
                echo '</div>';
            };

        };

0 个答案:

没有答案