You appear to be a bot. Output may be restricted
Description
Get the post thumbnailReturns the HTML for the thumbnail image which can then be wrapped in a link if required
Usage
$string = bw_get_thumbnail( $post_id, $size, $atts );
Parameters
- $post_id
- ( integer ) optional – the id of the content for which the thumbnail is required defaults to the current post id
- $size
- ( mixed ) optional default: thumbnail – the required image size: either a preset or specified in an array
- $atts
- ( array ) optional – array of key value pairs that may be needed
Returns
string HTML image tagSource
File name: oik/includes/bw_images.incLines:
1 to 22 of 22
function bw_get_thumbnail( $post_id = null, $size = 'thumbnail', $atts=NULL ) { $return_value = FALSE; if ($post_id == null) { $post_id = get_the_id(); } //bw_trace( $post_id, __FUNCTION__, __LINE__, __FILE__, "post_id" ); $thumbnail = bw_get_thumbnail_src( $post_id, $size ); //bw_trace2( $thumbnail, "thumbnail" ); if ( bw_array_get( $thumbnail, 0, FALSE) ) { $text = bw_array_get( $atts, "title", NULL ); $thumbnail = bw_force_size( $thumbnail, $size ); $data_thumb = kv( "data-thumb", $thumbnail[0] ); $classes = "bw_thumbnail " . bw_get_post_class( $post_id ); $extras = null; if ( $thumbnail[1] && $thumbnail[2] ) { $extras = kv( "loading", "lazy"); } $return_value = retimage( $classes, $thumbnail[0], $text, $thumbnail[1], $thumbnail[2], $data_thumb . $extras ); } //bw_trace( $return_value, __FUNCTION__, __LINE__, __FILE__, "return_value" ); return( $return_value ); }View on GitHub View on Trac