filtrod 2.9.0
post_thumbnail_html
Opis
Modyfikuje HTML miniaturki wpisu renderowanej przez the_post_thumbnail().
Przykład użycia
add_filter( 'post_thumbnail_html', ... )php
add_filter( 'post_thumbnail_html', 'wpdocs_thumbnail_wrapper', 10, 5 );
function wpdocs_thumbnail_wrapper( $html, $post_id, $post_thumbnail_id, $size, $attr ) {
return '<div class="post-thumbnail">' . $html . '</div>';
}
add_filter( 'post_thumbnail_html', 'wpdocs_thumbnail_wrapper', 10, 5 );
function wpdocs_thumbnail_wrapper( $html, $post_id, $post_thumbnail_id, $size, $attr ) {
return '<div class="post-thumbnail">' . $html . '</div>';
}Parametry
| Parametr | Typ | Opis |
|---|---|---|
$html | string | The post thumbnail HTML. |
$post_id | int | The post ID. |
$post_thumbnail_id | int | The post thumbnail ID, or 0 if there isn't one. |
$size | string | int[] | Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order). |
$attr | string | array | Query string or array of attributes. |
Wywołanie
Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'post_thumbnail_html', '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( 'post_thumbnail_html', 'twoja_funkcja', 10, 5 );
function twoja_funkcja($param_1, $param_2, $param_3, $param_4, $param_5) {
// Twój kod
}Popularne w tej kategorii