Injects max-width and removes height for videos too constrained to fit inside sidebars on frontend.
Description
See also
Parameters
$matches
arrayrequired- Pattern matches from preg_replace_callback.
Source
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;
}
Changelog
Version | Description |
---|---|
4.9.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.