Description
Return a random image from the images attached to the post
Usage
bw_get_random_image( $post_id, $size, $atts );Parameters
- $post_id
- ( ID ) required – the ID of the post to which the images are expected to be attached
- $size
- ( string ) required –
- $atts
- ( mixed ) required –
Returns
voidSource
File name: oik/includes/bw_images.incLines:
1 to 14 of 14
function bw_get_random_image( $post_id, $size, $atts ) { $arr_thumb = bw_get_attached_image( $post_id, 1, 'rand', $size ); //bw_trace( $arr_thumb, __FUNCTION__, __LINE__, __FILE__, "arr_thumb" ); $thumbnail = bw_array_get( $arr_thumb, 0, null ); $img = bw_array_get( $thumbnail, 0, null ); if ( $img ) { $text = bw_array_get( $atts, "title", NULL ); $classes = "bw_thumbnail " . bw_get_post_class( $post_id ); $return_value = retimage( $classes, $img, $text, null, null, kv( "data-thumb", $img) ); } else { $return_value = null; } return( $return_value ); }View on GitHub View on Trac
Invoked by
Calls
1 to 5 of 5
