Helper::get_thumbnail( string $size = 'small', string $before = '', string $after = '', bool $echo = true )
Returns or outputs the thumbnail of current video in loop
Parameters
- $size
-
(Optional)
Default value: 'small'
- $before
-
(Optional)
Default value: ''
- $after
-
(Optional)
Default value: ''
- $echo
-
(Optional)
Default value: true
Return
(string)
Source
File: includes/libs/themes/helper.class.php
public static function get_thumbnail( $size = 'small', $before = '', $after = '', $echo = true ){
$img_url = self::get_thumbnail_url( $size );
/**
* Filter that allows additional CSS classes to be added to images.
*
* @param array $classes Array of CSS classes.
* @param Video_Post $video The video post being processed.
*/
$classes = apply_filters(
'vimeotheque\themes\image_class',
// class no-lazy is needed for W3 Total Cache to avoid lazy loading images and breaking scripts
['vimeotheque-playlist', 'image', 'no-lazy'],
self::current_video_post()
);
$css_class = is_array( $classes ) ? implode( ' ', $classes ) : '';
$output =
$img_url ?
sprintf(
'<img src="%s" alt="" class="%s" />',
$img_url,
$css_class
) :
'';
if( $echo ){
echo $before . $output . $after;
}
return $before . $output . $after;
}
