我正在尝试获取单个帖子的精选图像的图像位置。我的代码如下使用wp_get_attachment_image_url()
什么也没有返回。任何想法我在这里做错了吗?由于从页面获取精选图像网址
<?php
$we_query = new WP_Query(array('post_status' => draft, 'page_id' => $wp_page_id));
while ($we_query->have_posts()) : $we_query->the_post();
if (has_post_thumbnail()) {
echo '<div class="buying-hero__image" style="background: rgba(0, 0, 0, 0) url("'.wp_get_attachment_image_url($wp_page_id, 'full').'")></div>';
}
echo '<div class="container">';
the_content();
echo '</div>';
endwhile; wp_reset_query();
?>
的特色是什么形象?个人帖子?那么你为什么要传递一个页面ID作为第一个参数...? – CBroe
@CBroe是页面的个别文章 – user2636556