我在这里浏览并找到了一些示例,但它们似乎没有将图像带入。这是我到目前为止发现的内容。这至少显示了帖子的链接,但我只需要显示两个帖子,并且我需要显示特色图片。
<!-<div class="recent_posts_home_container">
<h2>Recent Posts</h2>
<ul>
<?php
$recent_posts = wp_get_recent_posts();
foreach( $recent_posts as $recent ){
echo '<li><a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' . $recent["post_title"].'</a> </li> ';
}
?>
</ul>
</div>
<!-- end recent posts div -->