Created
July 24, 2012 14:08
-
-
Save christophercochran/3170083 to your computer and use it in GitHub Desktop.
Wrap oembeds with containing div and according styles for fluid videos in responsive design
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* OEMBED | |
-------------------- */ | |
.oembed-container { | |
position: relative; | |
height: 0; | |
margin-top: 1em; | |
padding-bottom: 56.25%; | |
overflow: hidden; | |
} | |
.oembed-container iframe, | |
.oembed-container object, | |
.oembed-container embed { | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100%; | |
height: 100%; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'oembed_dataparse', 'zero_embed_wrapper', 90, 3 ); | |
/** | |
* Filters output of oembed to wrap with a div to help with fluid video embeds. | |
* | |
* @since zero 0.5.1 | |
*/ | |
function zero_embed_wrapper( $output, $data, $url ) { | |
return '<div class="oembed-container">' . $output . '</div>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment