For this to work, you must have added the thumbnail support. You can use the following code in functions.php to add the support
add_theme_support( ‘post-thumbnails’ );
add_image_size('poster-full', 450, 9999, false);
and to display the image:
if ( has_post_thumbnail() ) {
the_post_thumbnail("poster-full");
}else{
echo "No thumbnail";
}
Related Posts:
- Is there a hook which fires after all thumbnails are generated?
- get_the_post_thumbnail_url with an unregistered size
- Cropped featured image replaces original image in gallery
- No srcset for hard-cropped thumbnails
- Removing Title Tag from Thumbnails
- Disable wordpress image sizes generation
- Lazyload post thumbnails
- How to stop thumbnail generation from some images and different size thumbnail generate
- Update old Post image metadata to ‘thumbnail’ wp_attached_file
- How to stop wordpress always displaying full-res images
- Fixing image names for a site being restored
- Filter for post_thumbnail: link to small src and add data-attribute [duplicate]
- Can we use featured image as third party website image URL
- Product Images Low Quality After Updating From WP 3.5 to 4 [closed]
- adding image to post thumbnail from another server
- How to add thumbnails to posts and pages automatically in a uniformed fixed elegant way?
- How to use default image as featured image by implement some code in function.php
- WordPress Multisite: Images moved to /sites/1?
- I cannot upload images to post or the media library in wordpress
- Why image Thumbnail url is not displaying with custom size?
- Making a thumbnail if there exist a link with. jpg or .png extension in WordPress
- WP is showing wrong image dimensions
- Programmatically get images by URL and save in uploads folder
- the_post_thumbnail responsive srcset not populating with custom image size
- How to change image type for specific size?
- is it possible to replace the use of gd_lib with imagick or ImageMagick?
- Change WordPress image URLs via filter
- Insert an image into a post by API
- set_post_thumbnail_size not cropping featured images, but reducing proportionally
- How to grab first image attached to post and display in RSS feed?
- Double thumbnails?
- Can’t Display Featured Image in RSS Feed
- Displaying a featured image (only img url) as the img src?
- When displaying the featured image, is has_post_thumbnail() necessary?
- Get original image from thumbnail URL
- WP 3.4 has missing photo data
- Save image as featured image
- Thumbnails produce unwanted gray pixels on white background [closed]
- Image Quality Thumbnail Compression in WordPress?
- WordPress reduces the full size image and uses it as the original
- Special purpose photos with each post
- How check that there is post thumbnail feature image or not on wordpress?
- Set Post Image Using Shortcode
- Print specific image size in galley loop
- WordPress crops images differently on retina screens?
- Image thumbnails not available post migration, but still accessible via direct URL – DB issue
- Upload media files to Amazon S3
- How can I add a “data-pin-nopin” the featured image html?
- how to link post-thumbnail to original img in a lightbox?
- Add padding while generating thumbnail
- Can’t generate thumbnail images
- Gallery with thumbnail carousel
- How to fit image to Thumbnail canvas size?
- Generate images to be associated for tag and category?
- Bulk-add featured images in posts with no featured image
- Should I not compress my jpeg files before uploading to avoid double compression?
- Is it possible to preserve original images in order to change image size later?
- Generating a certain sized thumbnail on the fly?
- add_image_size function not working
- Why doesn’t WordPress use the smaller sized image?
- Stop WordPress compressing images? – Quality is terrible
- Is it possible to enable the ‘Link To’ field under ‘Attachment Display Settings’ for a Featured Image?
- Get an image from url, resize it, and save on a custom folder (not the media library)
- Else/If Statement to Display Photo Descriptions
- Remove Additional image sizes created by theme
- Using Image Sizes for Custom Post Types outside the Loop
- Use default image as var
- Dynamically determine the width and height of a image file to be cropped & uploaded AFTER form submission given fixed aspect ratio
- Disable Media File Image Link On Mobile Devices
- Set two default featured images
- Placing a featured image into header
- Broken thumbnails (sometimes) with TimThumb
- Is it possible to save crop to a different size of the image when in image editor?
- How to only show div of caption if caption exists on featured image
- Apply manual image cropping not to thumbnail but medium_large size
- Display Multiple Photos as Featured Image when mouse moves on to it post
- How to echo images Urls from a wordpress post, that are relally in the post
- WordPress Responsive Image ( srcset ) not work properly
- How to Display Image Caption but Not Alt Text
- Image alt attribute
- How to set a post featured image from an already made custom field
- Why does wp_get_attachment_image_src return the wrong size, when the correct size exists?
- New portfolio items appearing smaller on the grid
- WordPress can’t detect any thumbnails size?
- stop wordpress from resizing feature gif images
- second featured post not displaying on page [closed]
- Does WordPress have a way of changing the ‘Natural’ size of uploaded images?
- WooCommerce Variation Swatches and Photos – get attribute thumbnail
- set_post_thumbnail_size only working for width
- Newly uploaded images are not updating in featured image
- Troubles with code for upload a image
- Image thumbnail on single product issue | WooCommerce
- Create a custom attachment thumbnail for quick page load
- get the post thumbnail returns the full size
- Why are my ‘medium’ images the wrong size
- Why is WordPress loading a different sized post thumbnail?
- Create post thumbnails from images stored outside of uploads directory
- Using the on-board image editor for featured images: edits are not being used
- has_post_thumbnail() Returns False on Scheduled Posts
- Media Library shows default image instead of image preview