filtrod 4.4.0
wp_calculate_image_srcset
Opis — z kodu źródłowego
Filters an image's 'srcset' sources.
Parametry
| Parametr | Typ | Opis |
|---|---|---|
$sources | array | { 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_array | array | { An array of requested width and height values. @type int $0 The width in pixels. @type int $1 The height in pixels. } |
$image_src | string | The 'src' of the image. |
$image_meta | array | The image meta data as returned by 'wp_get_attachment_metadata()'. |
$attachment_id | int | Image 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
}
// 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