Usage:
[featured-image size = "large" class = "featured-image" title = "something" alt = "image"]
Available attributes:
- class
- title
- alt
- thumbnail
- medium
- large
- full
and add the following code in your functions.php file
add_shortcode('featured-image', array('Featured_image_shortcode', 'cvf_post_thumbnail_shortcode') );
class Featured_image_shortcode {
public static function cvf_post_thumbnail_shortcode($atts, $content = '') {
$img_attr = '';
$atts['class'] = '';
$img_attr = array(
'class' => $atts['class'],
'alt' => trim(strip_tags($atts['alt'])),
'title' => trim(strip_tags($atts['title']))
);
if(!$atts['size']){
$atts['size'] = 'thumbnail';
}
return get_the_post_thumbnail(null, $atts['size'], $img_attr);
}
}