You’re using get_the_post_thumbnail()
and not the nonexistent get_post_thumbnail()
function, right?
As JohnG said, you have to pass the ID of the current post to get_the_post_thumbnail()
(the the_post_thumbnail()
function already handles that for you). The Function Reference in the WordPress Codex has many usage examples:
get_the_post_thumbnail($id); // without parameter -> Thumbnail
get_the_post_thumbnail($id, 'thumbnail'); // Thumbnail
get_the_post_thumbnail($id, 'medium'); // Medium resolution
get_the_post_thumbnail($id, 'large'); // Large resolution
get_the_post_thumbnail($id, array(100,100) ); // Other resolutions
Where $id
is the ID of the current post. You can get it via get_the_ID()
.
Related Posts:
- How to disable WordPress from creating thumbnails?
- set_post_thumbnail_size vs add_image_size
- the_post_thumbnail responsive srcset not populating with custom image size
- Set custom name for generated thumbnails
- New image size version only for the Featured Image file
- wp_get_attachment_image_src always returns full-sized image
- Add Title Attribute to WordPress Image the_post_thumbnail
- Can WordPress crop only the post thumbnails?
- Query the post which have a thumbnail
- Autogenerated Thumbnail compression depending on size
- How to use images uploaded with custom implementation of thickbox like the_post_thumbnail() functionality
- Media thumbnail for custom post inside post content
- Thumbnail and Featured Image With Fixed Sizes?
- List category posts – Thumbnails are not displaying
- Why am I getting errors in product.thumbnails.php? [closed]
- Is there a way to change a post’s thumbnail image(s)?
- how i can increase Featured thumbnails size?
- How check that there is post thumbnail feature image or not on wordpress?
- Force WordPress to strip/remove EXIF/IPTC metadata when resizing thumbnails
- If I Regenerate Thumbnails, would WordPress delete the existing Thumbnails and replace them with ‘new copies’?
- Is it possible to nest get_previous_post()?
- How to get cropped thumbnail source for custom post type
- Get ID of featured image using “get_post_thumbnail_id(the_ID())” – without printing to screen?
- How to offset thumbnails to the center?
- Sidebar Thumbs Squished?
- Aligning the thumbnail image
- Post thumbnail not working after regenerate
- How do get post thumbnail into plugin?
- “Medium” size image displayed instead of “thumbnail” in only one post, other posts are fine
- How to create resized versions of images added with wp_insert_attachment
- get_post_thumbnail_id() Doesn’t return value [closed]
- How To Add and Display Category Image
- Can’t get post thumbnail to display in foreach loop
- Show posts image attachments
- Thumbnail is showing outside its div instead of inside it
- get_post_thumbnail does not display thumbnail
- Category page with thumb is ok but can’t do the same with tags
- how can I call a posts featured image in any template?
- how to resize thumbnail image
- Different thumbnails for index and article page
- Thumbnails not being generated for PDF files
- Thumbnail size problem Desktop vs Mobile site
- How do you code a featured image into an XML as a jpg link, instead of using a data-id number?
- How to change the format of thumbnails into wordpress theme?
- display div tag only if post has thumbnail
- Thumbnails are hard cropped not matter what
- Thumbnails regenerate wp_generate_attachment_metadata
- Featured image size always cropped bottom
- set_post_thumbnail() shows Unattached on backend under Media
- Allow ‘Set featured images’ to select multiple images
- Why wordpress doesn’t generate thumbnails?
- Force Regenerate Thumbnails Not Working
- Trouble Retrieving Thumbnail URL on Front-Page
- I would like my posts to pull my custom cropped thumbnail instead of creating its own thumbnail from Featured Image
- WordPress save thumbnail but don’t show it [closed]
- Automatic adding thumbnail to post
- Different thumbnail size than actual picture in post
- Where is the template from the_post_thumbnail()?
- Images thumbnail not cropping square
- How to add multiple image sizes of the same size with add_image_size
- change set_post_thumbnail_size according to post type admin page
- Can’t extract and set SVG dimensions
- Implementing Zurb’s Interchange Into WordPress
- No srcset for hard-cropped thumbnails
- add_image_size and add_filter(‘image_size_names_choose’, ‘my_custom_image_sizes’) not working with wordpress 3.5.2
- Custom post type thumbnail / Media Library WP_DEBUG notice [closed]
- Archive Thumbnail Gallery
- Thumbnails produce unwanted gray pixels on white background [closed]
- How to get full absolute url for post attachment?
- How to check the array of featured images IDs
- Duplicated featured image is not showing
- Create thumbnail size only for a few images?
- How to find post with broken image link and delete that post
- Only Display Thumbnail if Larger Than
- WP Query to set post thumbnail for existing old posts
- How can I check for a thumbnail in WordPress?
- array set title and alt in the_post_thumbnail
- Get thumbnail image according to the screen
- Displaying Post Featured Images on All Pages
- Use Featured Image of Post as Header Image
- How to display featured image description and title?
- Make image full width
- Facebook Does Not Grab Correct og:Image
- get_the_post_thumbnail($post->ID, ‘thumbnail’); not working. How can I solve this?
- How to add thumbnails to posts and pages automatically in a uniformed fixed elegant way?
- Smaller thumbnail in the_content
- Unable to set Custom “Link URL” for Featured Image, and More?
- On what point (hook) does the_/has_post_thumbnail() load?
- Display Multiple Photos as Featured Image when mouse moves on to it post
- Set featured image from auto generated video thumbnail url php
- Does WordPress have a way of changing the ‘Natural’ size of uploaded images?
- How to cropped thumbnail image without distorting it?
- Set Featured Image Based on Custom Field
- How to have featured image show in standard RSS Widget
- Link from Thumbnail to Post not working
- Change role’s settings influence post-thumbnail
- Featured Image Isn’t showing with cropped, How to show it?
- How to add text & call to action button to featured image on homepage?
- Featured image as background in a div using headway
- Hot to change resized image link on posts