单据中标记了传递岗位ID的参数deprecated
.
这意味着,为了使自定义循环工作,您需要添加$recent->the_post()
However, 正如您所指出的,当您使用wp_get_posts
, 因此,我建议将查询修改为自定义循环:
$args = array( \'post_status\' => \'pending\');
$recent_posts = new WP_Query( $args );
然后,您应该能够使用您的代码:
见下文:
while ( $recent_posts->have_posts()) {
$recent_posts->the_post(); // Add this here to cause the other functions to work without the post ID
echo \'<div id="votes"><li id="voteimage"><a href="\' . get_permalink() . \'" title="\' . esc_attr( $recent["post_title"] ) . \'">\';
echo get_the_post_thumbnail($recent["ID"], \'thumbnail\');
echo \'</li></a>\';
echo \'<li class="vote-title"><a href="\' . get_permalink() . \'" title="Look \'.esc_attr($recent["post_title"]).\'" >\' . $recent["post_title"].\'</a> </li>\';
echo \'<li class="vote-desc"><a href="\' . get_permalink() . \'">\' . get_the_excerpt() . \'</a> </li>\';
echo \'</div><br></br>\';
}
Also note 那个
get_the_excerpt()
将返回未筛选的内容。您可能想用
apply_filters()
像这样:
apply_filters(\'the_content\', get_the_excerpt());