因此,我在我的网站上有几种自定义帖子类型,并希望在我的主页上有一个位置,显示来自3种不同自定义帖子类型的最近6篇帖子。我已经查看了上的设置How to display recent posts added in custom post types 但我不知道如何从1个以上的帖子类型中提取它。
<h2>Recent Posts</h2>
<ul>
<?php
$recent_posts = wp_get_recent_posts(array(\'post_type\'=>\'books\',\'stories\',\'movies\'));
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>