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
- Get 10 posts from a WP_Query. If less than 10, get the remainder from elsewhere
- 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?
- Single Page WordPress Theme – Using page templates
- 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?
- How to handle thumbnails
- 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
- Cannot get full thumbnail size using the_post_thumbnail
- How WordPress converts URL to $query_string
- 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
- show a post from a specific post format
- paged > max_num_pages won’t throw 404
- Featured Images are not able to be set
- Display recent posts with thumbnail
- Displaying recent post excerpts on static front page
- Reasons why all thumbnail sizes aren’t working
- Limit Loop to 5 Posts?
- How do I Add images uploaded in the post to a default custom field
- WP_Query not getting all posts, just tagged posts
- 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
- theme directory fallback image outputs url and not the image
- Show only pages you are author of
- Add class every 4 post like , class_1, class_2, class_3, class_4 and class_1, class_2, class_3, class_4
- 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()
- Local variable name in setup_postdata()
- 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
- Why content is not adding for each blog post
- Full width thumbnail
- Featured Image Module Randomly Disappears
- Best way to allow for extended use of WordPress functions inside single.php
- 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
- How to close open divs in post loop
- 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?
- Custom loop menu is not working
- WP “optimizing” PNGs into thumbnails 5X larger than originals – FIX
- optimized PNGs 5X larger than originals