sizes ) ) {
echo $photo->url;
} elseif ( ! empty( $photo->sizes->thumbnail ) ) {
echo $photo->sizes->thumbnail->url;
} else {
echo $photo->sizes->full->url;
}
}
/**
* Renders the options for a photo select field.
*
* @since 1.0
* @param string $selected The selected URL.
* @param object $photo An object with photo data.
* @return void
*/
static public function get_src_options( $selected, $photo ) {
if ( ! isset( $photo->sizes ) ) {
echo '';
} else {
$titles = array(
'full' => _x( 'Full Size', 'Image size.', 'fl-builder' ),
'large' => _x( 'Large', 'Image size.', 'fl-builder' ),
'medium' => _x( 'Medium', 'Image size.', 'fl-builder' ),
'thumbnail' => _x( 'Thumbnail', 'Image size.', 'fl-builder' ),
);
foreach ( $photo->sizes as $key => $val ) {
if ( ! isset( $titles[ $key ] ) ) {
$titles[ $key ] = ucwords( str_replace( array( '_', '-' ), ' ', $key ) );
}
echo '';
}
}
}
}