Wordpress循环函数取决于全局变量,所以在运行循环之前,您必须从页面获取数据。
一般来说,你应该能够做这样的事情-
$page_id = get_the_ID(); //this is important, we will use this later
while(have_posts()): the_post();
//do something with the post here
echo get_the_post_thumbnail( $page_id ); //this is the page featured image
//still displaying any post related data
endwhile;