A helper function to calculate the image sources to include in a 'srcset' attribute.
Une fonction d'aide pour calculer les sources d'images à inclure dans un attribut "srcset".
$size_array, $image_src, $image_meta, $attachment_id = 0
Sortie :
@param int[] $size_array {
@param string $image_src The 'src' of the image.
@param array $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'.
@param int $attachment_id Optional. The image attachment ID. Default 0.
@return string|false The 'srcset' attribute value. False on error or when only one source exists.
add_filter('wp_calculate_image_srcset', 'custom_image_srcset', 10, 5);
function custom_image_srcset($sources, $size, $src, $meta, $id) {
return $sources;
}
Chargement des actualités...