/ Published in: PHP
- Use custom image size within template (including if exist)
- Add a class name to a custom image size
- Add a class name to a custom image size
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// Add Feature Image size, hard crop if ( function_exists( 'add_image_size' ) ) { add_image_size( 'feature-image', 570, 285, true ); add_image_size( 'feature-image-small', 285, 285, true); add_image_size( 'feature-image-home', 285, 303, true); } // To use the image, if feature image exist <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'feature-image' ); } ?> // Add a class to the image