Let’s examine the differences between the working and the not-working code:
- Working:
has_post_thumbnail( $post->ID )
- Not Working:
get_the_post_thumbnail();
The only difference I see is that you’re passing the $postID
explicitly to the working function, and not passing it to the non-working function. So, try this:
get_the_post_thumbnail( $post->ID, 'medium' );
You can var_dump()
or echo
it to verify whether or not you’re getting the correct data returned.
Related Posts:
- How do I use element instead of tags in WordPress post content having webP support?
- Show featured image next to post-teasers in Genesis Framework?
- Errors when uploading images in WP 3.5
- Set size for attachments
- Get all images in post and comments like Twitter before post title
- Remove Featured Image & All Media Uploaded to the Post
- preg_replace not removed “class”
- how to give multiple post thumbnails to a post
- How to display post title inside thumbnail?
- Only show featured image on exerpt and exclude images in post
- Delete media from the post but keep my featured image and post
- Thumbnails and images in the blog post are not loading
- Blog featured images disappeared on my homepage
- Center crop the feature image
- Add another feature image box
- How to show category image if no featured image is set?
- Set featured image on creating new post
- Latest news mini images
- Post thumbnail height problem
- Import alt text in set_post_thumbnail
- website images getting corrupt automatically
- How do you add thumbnail support for custom post types?
- removing inline styles from wp-caption div
- Find the post an attachment is attached to
- Post slugs and images cannot have same name?
- Add existing images from Media Library in to custom gallery
- Replace image attributes for lazyload plugin (data-src)
- Download external images if post is publish
- How do I sort (order) the results from `get_children()`?
- Can I load posts via Ajax?
- how to display post content without post image?
- How to wrap every image in a post with a div?
- Get post embedded image caption
- how to grab first link in post… and of course call it
- Load post content into div with ajax
- Delete Post From Front-End and attachment permanently
- Limit function to specific post category
- Post taxonomy from exif data
- Remove inline width from figure
- Underscores.me retrieve next / previous post thumbnail in post_nav function
- WordPress Theory Lesson – Image Columns within posts with alignment?
- Modify WP_Post before processing
- Get image from post’s gallery
- Image Insert into posts and pages not working after 3.2.1 update
- Copying and pasting emoji in a wordpress post
- How to display featured image without it appearing in post?
- Can I use images as anchor tags with
- creating front end image uploader that uploads images as posts
- Get attachments for posts that belongs to a specific category
- why are images not full size?
- List all categories with featured image from post?
- How would one change the default url structure of attachments?
- If statement to check if post has image
- Gather posts into a cart/lightbox and share with another user
- How to check if single.php has already called the_post_thumbnail function
- Thumbnail Image to go in the post aswell
- update image path with words starting uppercase to lowercase chars
- Uploading images in custom post form
- Make insterted image point to post url instead of attachment page
- Get URL from all images in a post
- Image behind the post’s title
- Post Title to featured Image ALT
- Show more than 200 images in one post
- How to get all inline images in post content? [duplicate]
- Hide thumbnail if there is a gallery on the post
- Image on rss feed on post
- How to Featured content with images in home page?
- select post preview image from nextgen gallery
- How to show a featured image inside a post in only 1 single category
- Link post images to post
- How to get the next and previous image title from attachment or gallery?
- WordPress as CMS: How to manage/handle images assigned to a post as full-sized background images in a slideshow?
- how can display a post on home screen without images
- How to exclude native lazy loading from first image in post content?
- Rewrite image links from attachment id to attachment link
- Aligning images in the wp editor not working. How do i get this to work in custom theme?
- unable to write to the database while uploading images
- Change the size of the featured image for post?
- Display image gallery if more than 1 image
- Set featured image as hero image on each page
- Post images are not displayed in media library
- Delete attached images from posts
- post thumbnails error
- Schedule image post on download
- How to get all posts in gallery post format template
- How to force regenerate thumbnails in WordPress posts?
- Customizing individual images on posts
- Stop images from being displayed on the front-end of the site
- Update all images url imported from HTML pages
- Thumbnail With Next/Prev Links Not Showing Next Post?
- Relative Image Urls in Posts are starting from root – Not from WordPress Address (URL) at General Settings
- How do I get thumbnails?
- Featured Images link to post parent
- Post thumbnail dependant on category
- How do I insert a custom field in a user submitted post?
- Only show posts with image and the correct ammount of posts in loop
- Get attachment if matches a variable
- $attachment->post_title not displaying title
- Full width images within post content
- Download button under all images WordPress