WP_Widget_Text::inject_video_max_width_style
Injects max-width and removes height for videos too constrained to fit inside sidebars on frontend.
Метод класса: WP_Widget_Text{}
Хуков нет.
Возвращает
string. HTML Output.
Использование
$WP_Widget_Text = new WP_Widget_Text(); $WP_Widget_Text->inject_video_max_width_style( $matches );
- $matches(массив) (обязательный)
- Pattern matches from preg_replace_callback.
Заметки
| Смотрите: WP_Widget_Media_Video::inject_video_max_width_style() |
Список изменений
| С версии 4.9.0 | Введена. |
Код WP_Widget_Text::inject_video_max_width_style() WP Widget Text::inject video max width style WP 7.1.2
public function inject_video_max_width_style( $matches ) {
$html = $matches[0];
$html = preg_replace( '/\sheight="\d+"/', '', $html );
$html = preg_replace( '/\swidth="\d+"/', '', $html );
$html = preg_replace( '/(?<=width:)\s*\d+px(?=;?)/', '100%', $html );
return $html;
}