WP HOOKS
filtrod 4.4.0

wp_calculate_image_srcset

Args 5Plik wp-includes/media.phpDokumentacja WP ↗

Opis — z kodu źródłowego

Filters an image's 'srcset' sources.

Parametry

ParametrTypOpis
$sourcesarray{ One or more arrays of source data to include in the 'srcset'. @type array $width { @type string $url The URL of an image source. @type string $descriptor The descriptor type used in the image candidate string, either 'w' or 'x'. @type int $value The source width if paired with a 'w' descriptor, or a pixel density value if paired with an 'x' descriptor. } }
$size_arrayarray{ An array of requested width and height values. @type int $0 The width in pixels. @type int $1 The height in pixels. }
$image_srcstringThe 'src' of the image.
$image_metaarrayThe image meta data as returned by 'wp_get_attachment_metadata()'.
$attachment_idintImage attachment ID or 0.

Wywołanie

Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'wp_calculate_image_srcset', 'twoja_funkcja', 10, 5 );

function twoja_funkcja($param_1, $param_2, $param_3, $param_4, $param_5) {
	// Twój kod
}

Popularne w tej kategorii