On a Wordpress site I am maintaining, the client wants to have a different header image for the blog post than what appears in the thumbnail on the blog roll page and wherever the thumbnail to the blog post appears on the site.
Right now it seems that the featured image is used for both the header image and the thumbnail.
Is there a way where these images can be different?
Any help is appreciated, thanks!
If you do this through your theme files or if you develop a plugin, it is not easy to explain it here. But you can use a plugin and do this easily. 1. "Multiple Post Thumbnails" plugin. Install this on your site ( or download this file and include it on your functions.php file https://github.com/voceconnect/multi-post-thumbnails/blob/master/multi-post-thumbnails.php ) and add following code to use another post image.
if (class_exists('MultiPostThumbnails')) {
new MultiPostThumbnails(
array(
'label' => 'Secondary Image',
'id' => 'secondary-image',
'post_type' => 'post'
)
);
}
After that you can call for images using,
get_the_post_thumbnail($post_type, $thumb_id, $post_id, $size, $attr, $link_to_original);
And also you can use add_image_size( $size_id, $width, $height, $hard_crop );
function to specify the size of the image.