Use this function to output any post featured image using its ID:
1 | <img src="<?php echo MDTF_HELPER::get_post_featured_image(777, '500x300'); ?>" alt="" /> |
In the loop use $post->ID:
1 | <img src="<?php echo MDTF_HELPER::get_post_featured_image($post->ID, '500x300'); ?>" alt="" /> |
You can set any size you want by alias for the result image, for example: '800x600', but this should be always less or equal to the size of the original image, + be attentive with image proportions.
1 | <?php public static function get_post_featured_image($post_id, $alias) ?> |