Skip to content

Instantly share code, notes, and snippets.

@jester1979
Created January 27, 2015 20:26
Show Gist options
  • Save jester1979/65707a48ae746e1b80e2 to your computer and use it in GitHub Desktop.
Save jester1979/65707a48ae746e1b80e2 to your computer and use it in GitHub Desktop.
oEmbed transparancy
add_filter( 'embed_oembed_html', 'oembed_transparency', 10, 4 );
/**
* oEmbed Transparency.
*
* Used so that menus can appear on top of videos.
*
* @since 1.0.0
*
* @author Bill Erickson
* @link http://www.billerickson.net/code/oembed-transparency
*
* @param string $html
* @param string $url
* @param array $attr, shortcode attributes
* @param int $post_id
* @return string The embed HTML on success, otherwise the original URL.
*/
function oembed_transparency( $html, $url, $attr, $post_id ) {
if ( strpos( $html, "<embed src=" ) !== false )
return str_replace( '</param><embed', '</param><param name="wmode" value="opaque"></param><embed wmode="opaque" ', $html );
elseif ( strpos( $html, 'feature=oembed' ) !== false )
return str_replace( 'feature=oembed', 'feature=oembed&wmode=opaque', $html );
else
return $html;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment