-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();
?>
這顯示所有我的博客文章作爲縮略圖而不是收藏了職。 有什麼幫助嗎?