filtrod 2.9.0
embed_oembed_html
Opis
Modyfikuje HTML osadzonej treści oEmbed — np. aby owinąć osadzenie w responsywny kontener.
Przykład użycia
add_filter( 'embed_oembed_html', ... )php
add_filter( 'embed_oembed_html', 'wpdocs_wrap_oembed', 10, 4 );
function wpdocs_wrap_oembed( $html, $url, $attr, $post_id ) {
return '<div class="osadzenie">' . $html . '</div>';
}
add_filter( 'embed_oembed_html', 'wpdocs_wrap_oembed', 10, 4 );
function wpdocs_wrap_oembed( $html, $url, $attr, $post_id ) {
return '<div class="osadzenie">' . $html . '</div>';
}Parametry
| Parametr | Typ | Opis |
|---|---|---|
$cache | string | The cached HTML result, stored in post meta. |
$url | string | The attempted embed URL. |
$attr | array | An array of shortcode attributes. |
$post_id | int | Post ID. |
Wywołanie
Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'embed_oembed_html', 'twoja_funkcja', 10, 4 );
function twoja_funkcja($param_1, $param_2, $param_3, $param_4) {
// Twój kod
}
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'embed_oembed_html', 'twoja_funkcja', 10, 4 );
function twoja_funkcja($param_1, $param_2, $param_3, $param_4) {
// Twój kod
}