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.
- "Advanced Custom Field" Plugin
Using this plugin you can do many more things. And you can add any numbers of post thumbnails using this. And almost all the other custom input types can be easily add to your theme.