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 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?
- 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
- How to handle thumbnails
- Getting Permalink within the loop
- 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]
- 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?
- 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
- 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
- How to show user online status on their posts?
- Custom get_the_excerpt() only works on first post
- How do I build a post_thumbnail based archive? [closed]
- Echo all category names, apart from one
- How do I turn a post thumbnail into a background image?
- how to get the post attachement image in full size?
- Featured Image meta box not showing up
- How do I remove inline style in featured image markup?
- Get the amount of posts on a given page
- How to list articles by year based on url?
- Set a featured image as a replacement to the header image
- Dynamic Post Thumbnail →
- How To Pick Custom Size Of Uploaded Image In Theme Via the_post_thumbnail();?
- 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?
- Previous and Next links not populating, have I missed something?
- Full width featured thumbnail
- Retrieve WordPress’ the_content() with jQuery
- Style first 3 posts differently with WP_Query [duplicate]
- WP_Query not getting all posts, just tagged posts
- 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
- control posts order by select option
- Problem with Displaying Custom Theme Page’s Content
- Why content is not adding for each blog post
- 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
- 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
- Checking conditionals
- 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?
- 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?
- How do I work with responsive images in WordPress? (img srcset/sizes)
- I want to resize post featured image without cropping image. How?
- WP “optimizing” PNGs into thumbnails 5X larger than originals – FIX