WP_Widget_Media_Video::inject_video_max_width_style()
Inject max-width and remove height for videos too constrained to fit inside sidebars on frontend.
Метод класса: WP_Widget_Media_Video{}
Хуков нет.
Возвращает
Строку
. HTML Output.
Использование
$WP_Widget_Media_Video = new WP_Widget_Media_Video(); $WP_Widget_Media_Video->inject_video_max_width_style( $html );
- $html(строка) (обязательный)
- Video shortcode HTML output.
Список изменений
С версии 4.8.0 | Введена. |
Код WP_Widget_Media_Video::inject_video_max_width_style() WP Widget Media Video::inject video max width style WP 6.7.1
public function inject_video_max_width_style( $html ) { $html = preg_replace( '/\sheight="\d+"/', '', $html ); $html = preg_replace( '/\swidth="\d+"/', '', $html ); $html = preg_replace( '/(?<=width:)\s*\d+px(?=;?)/', '100%', $html ); return $html; }