Skip to content

Instantly share code, notes, and snippets.

@FriendlyWP
Created October 26, 2013 01:42
Show Gist options
  • Save FriendlyWP/7164332 to your computer and use it in GitHub Desktop.
Save FriendlyWP/7164332 to your computer and use it in GitHub Desktop.
Remove dimensions from oEmbed videos so that YouTube and other oEmbedded videos resize to fit device width. This only works for videos that use <a href="http://codex.wordpress.org/Embeds">oEmbed</a>.
// VIDEO
// remove dimensions from oEmbed videos
add_filter( 'embed_oembed_html', 'tdd_oembed_filter', 10, 4 ) ;
function tdd_oembed_filter($html, $url, $attr, $post_ID) {
$return = '<figure class="video-container">'.$html.'</figure>';
return $return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment