Skip to content

Instantly share code, notes, and snippets.

@Mantish
Last active December 23, 2015 09:49
Show Gist options
  • Save Mantish/6616927 to your computer and use it in GitHub Desktop.
Save Mantish/6616927 to your computer and use it in GitHub Desktop.
Wordpress responsive youtube embeds
.embed-container {
height: auto;
max-width: 100%;
overflow: hidden;
padding-bottom: 56.25%;
padding-top: 30px;
position: relative;
}
.embed-container iframe,
.embed-container object,
.embed-container embed {
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
}
<?php
if ( ! isset( $content_width ) ) $content_width = 830;
function embed_responsively($iframe) {
return '<div class="embed-container">'.$iframe.'</div>';
}
add_filter('oembed_result', 'embed_responsively');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment