Created
November 23, 2014 10:05
-
-
Save yanknudtskov/a8a8959efa341ef650e2 to your computer and use it in GitHub Desktop.
WordPress, Bootstrap 3 Render a responsive media embed
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
<?php | |
function get_embed_video_html($url) { | |
$embed_link = '[embed]'.$url.'[/embed]'; | |
$embed_link = apply_filters('the_content', $embed_link); | |
$output = ''; | |
$output .= '<div class="responsive-video">'; | |
$output .= $embed_link; | |
$output .= '</div>'; | |
return $output; | |
} | |
echo get_embed_video_html($url_to_video); | |
?> | |
.responsive-video { | |
position: relative; | |
padding-bottom: 56.25%; | |
padding-top: 60px; overflow: hidden; | |
} | |
.responsive-video iframe, | |
.responsive-video object, | |
.responsive-video embed { | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100%; | |
height: 100%; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment