我使用以下代码将wordpress博客中的内容导入静态html网页: (从wordpress自己的文档中学到https://codex.wordpress.org/Integrating_WordPress_with_Your_Website)
<?php
//Query 5 recent published post in descending order
$args = array( 'category_name' => 'news', 'posts_per_page' => '-1', 'order' => 'DESC','post_status' => 'publish' );
$recent_posts = wp_get_recent_posts( $args );
//Now lets do something with these posts
foreach( $recent_posts as $recent )
{
echo "<section class='main'>";
echo ''.$recent["post_category"];
echo '<h4>'.$recent["post_title"];
echo "</h4>";
echo '<p class="smalls">';
echo mysql2date('F, j, Y',$recent["post_date"]);
echo "</p>";
echo '<p class="smalls">'.$recent["post_content"];
echo "</p>";
echo "</section>";
//Do whatever else you please with this WordPress post
}
?>
照片工作正常,但谈到视频时,我能找到的唯一解决方案是使用iframe。否则我最终只会显示一个网址
如何在不使用iframe的情况下显示导入的wordpress帖子中的视频?