WordPress loop functions depend on the global variables, so you will have to get the data from page before you run the loop.
Generally, you should be able to do something like this-
$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;
Related Posts:
- The the_post_thumbnail without srcset?
- Get the first image from post content (eg.: hotlinked images)
- Get ‘page’ number with infinite scroll
- How to add a 2nd “featured image” to a post?
- Why doesn’t /2013/01/ properly return January’s archives in archive.php?
- Strategy to get post meta for use outside the loop
- Grab the first paragraph of each post
- How to change post thumbnail title and alt attributes to post title?
- Unexpected width and srcset attributes for the_post_thumbnail();
- A two column loop with one lead post
- Change loop order via form or link (jquery, not URL)
- First post of each category
- Is there any need to use both wp_reset_postdata and wp_reset_query together?
- query posts in wordpress
- Getting Permalink within the loop
- the_content() in single-{post-type}.php problem
- WordPress loop specific thumbnail size
- Why does this loop only work on the homepage?
- Change display of featured image for pages in twenty seventeen theme
- Setting hero/splash section as a blog post
- posts_nav_link(); not showing up on static pages
- How to set dimensions of the post thumbnails (featured images)
- How to regenerate thumbnails when they’re stored on S3
- How to retrieve an image from a post and display it before excerpt of a post? [duplicate]
- Finding Page Template and Displaying Content
- Why is the first query affecting the second query, even after wp_reset_query() and wp_reset_postdata(), but not on the second page?
- Link won’t show using the_permalink();
- Some doubts about how to show posts in a custom theme?
- Force index.php have_posts() loop to exit if no sticky posts found
- Can’t show custom post thumbnail sizes as background images
- paged > max_num_pages won’t throw 404
- Featured Images are not able to be set
- Displaying recent post excerpts on static front page
- Limit Loop to 5 Posts?
- How do I Add images uploaded in the post to a default custom field
- How to show user online status on their posts?
- Custom get_the_excerpt() only works on first post
- Echo all category names, apart from one
- Reactor Theme: Prevent Post Thumb on Post
- Featured Image meta box not showing up
- Dynamic Post Thumbnail →
- Issue on Getting Custom post type Thumbnail’s URL
- How To Pick Custom Size Of Uploaded Image In Theme Via the_post_thumbnail();?
- Change image size depending on page
- How to disable thumbnail filter for a specific template part or image size?
- the_post_thumbnail() get the URL to the “medium” sized image
- How can I prevent posts with no title showing up in my query?
- How can I use the WordPress Loop and Pagination in multiple instances but different scenarios throughout my site?
- Twenty Seventeen Pages Loop
- Full width featured thumbnail
- How does the loop know which post to view?
- Exclude subcategory from wp_query
- Style first 3 posts differently with WP_Query [duplicate]
- first excerpt fine, subsequent post excerpts shift to the right instead of displaying vertically [closed]
- Pagination and multiple loops
- How can I get the featured image or the first image for a post/page and display it as a banner?
- How to make excerpt image be full size instead of thumbnail?
- How can I scale down the width of images in bulk that are embedded in posts throughout the site?
- Add image URL automatically to custom field?
- How can I sort my loop based on meta data, using a form?
- List categories of a post hierarchically?
- Exclude parent categories from the_category() within the loop
- get_the_terms() returning wrong results inside of loop
- Show only pages you are author of
- How do I make my terms for each product display via foreach loop? (woocommerce)
- WordPress Insert ads after every 5th post
- White screen of death on index.php page 3 and above?
- WordPress theme files Organization
- Infinite loop when nesting have_posts()
- Loop is breaking my theme. How can I fix?
- my ajax wont sent the data, please correct my code
- Created blank theme for REST API, featured image not appearing on admin side
- control posts order by select option
- Problem with Displaying Custom Theme Page’s Content
- Full width thumbnail
- Featured Image Module Randomly Disappears
- Single Featured Image Repeating
- Conditional loop based on current page
- Loop through all posts, show attachment if there
- Suppress the_content filter in a nested loop
- Tags interfering with next_post_link();
- Any disadvandages if I style the wordpress align classes without img and .wp-caption prefix
- Simple loop with shortcode rendering problem
- How get the 10 most viewed pages (not post)
- apply_filters to featured image
- The normal loop with different styles doesn’t work in search.php
- Checking conditionals
- issue displaying variations in custom template using WPeC 3.8.9.2
- Show post thumbnail only if it exists using timthumb
- All post ids are the same after this query but rewind_posts() does not seem to work here?
- Not Found when using activity stream as front page with BuddyPress
- Why does the first loop take arguments from the second loop?
- have_posts() return false on single post
- How to defeat “Blog pages show at most __ posts” setting in the loop?
- WordPress Loop with Custom Post Type for Bootstrap Accordion [closed]
- Why am I getting posts back when I shouldnt
- Is there any reason that other theme elements (such as nav menus) shouldn’t be within the loop?
- Meaning of “if ( is_home() && ! is_front_page() )” snippet?
- How do I work with responsive images in WordPress? (img srcset/sizes)
- I want to resize post featured image without cropping image. How?