Skip to content

Instantly share code, notes, and snippets.

@Mantish
Last active Dec 23, 2015
Embed
What would you like to do?
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