-1
我想以缩略图的形式显示用户的收藏帖子。 目前使用此代码:获取用户最喜欢的帖子缩略图
<?php
$post_id = array(get_user_favorites($user_id, $site_id));
$loop = new WP_Query($post_id);
if($loop->have_posts()):
while ($loop->have_posts()):
$loop->the_post();
if (has_post_thumbnail()) : // thumbnail check
$image = wp_get_attachment_image_src(get_post_thumbnail_id());
?>
<div>
<img src="<?php echo esc_url($image[0]); ?>" />
</div>
<?php
endif;
endwhile;
endif;
wp_reset_query();
?>
这显示所有我的博客文章作为缩略图而不是收藏了职。 有什么帮助吗?