Adding custom featured image

You are creating your own template page and you would want to display featured image, with custom size.
if ( function_exists( 'add_image_size' ) ) {
add_image_size( 'slider', 991, 328, true );}

Add this code to your functions.php file
And than go to your custom template page and add this code
if (has_post_thumbnail()) {
echo 'div id="slider-image"';
What function does is, that it checks if the featured image has been added, and if added it will create the div and display the image with the width and height you mentioned in the function file. Yes it’s that simple.

%d bloggers like this: