Oembed wmode

DescriptionWordpress snippet by - 12/13/10

If your oembed video is overlapping you fixed position toolbars, like the buddypress admin bar or a chat client use this filter by RAY. Just copy this snippet into your functions.php and the oembed embed paramater wmode will be set to transparent. Just switch it to opaque if you need to.

There is no way to z-index the default oembed player to get it to display above lower z-indexed objects, to get it to cooperate with the z-indexing you need to assign an embed wmode paramater to opaque or transparent.

Tags

function my_oembed_wmode( $embed ) {
	if ( strpos( $embed, '<param' ) !== false ) {
   		$embed = str_replace( '<embed', '<embed wmode="transparent" ', $embed );
   		$embed = preg_replace( '/param>/', 'param><param name="wmode" value="transparent" />', $embed, 1);
    }
   	return $embed;
}
add_filter( 'embed_oembed_html', 'my_oembed_wmode', 1 );
  • Share
Submitted by: Adam J Nowak
http://hyperspatial.com

3 Responses to “Oembed wmode”

  1. Excellent! Worked instantly - i have jquery page loader which was being overlapped by oembed embedded videos. this solved it just like that.

    Thanks for sharing!

    vulgarbulgar says:

Comments and Feedback