The best way to Forestall Youtube oEmbed from Overriding your WordPress Content material
Have you ever ever been to a website the place you discover that media parts resembling YouTube movies override different content material? This will occur when you have drop down menus, floating bars, lightbox popups and many others. On this article, we are going to present you the right way to forestall YouTube oEmbed from overriding your WordPress content material.
Instance:

Once you embed a video in WordPress, by default it doesn’t have wmode=clear worth. What meaning is that video parts have the very best precedence and it’ll override any floating or dynamic ingredient.
This will get actually annoying. So let’s check out the right way to add ?wmode=clear to YouTube movies in WordPress with out utilizing the ugly iFrames methodology.
All it’s a must to do is open your theme’s features.php file or higher but your website’s plugin file and paste the next code:
function add_video_wmode_transparent($html, $url, $attr) {
if ( strpos( $html, "<embed src=" ) !== false )
{ return str_replace('</param><embed', '</param><param identify="wmode" worth="opaque"></param><embed wmode="opaque" ', $html); }
elseif ( strpos ( $html, 'characteristic=oembed' ) !== false )
{ return str_replace( 'characteristic=oembed', 'characteristic=oembed&wmode=opaque', $html ); }
else
{ return $html; }
}
add_filter( 'embed_oembed_html', 'add_video_wmode_transparent', 10, 3);
Supply
source https://wpnullfree.top/the-best-way-to-forestall-youtube-oembed-from-overriding-your-wordpress-content-material/
Nhận xét
Đăng nhận xét