Monday, 20 August 2018

Response video embeds in WordPress


 <?php
//Add Response code to video embeds in WordPress
function full_width_embed_html( $html ){
  return '<div class="video-container">' . $html . '</div>';
}
add_filter( 'embed_oembed_html', 'full_width_embed_html', 10, 3 );
add_filter( 'video_embed_html', 'full_width_embed_html' );
?>
<style>
.video-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  max-width: 1200px;
  margin: 0 auto;
}
 
.video-container iframe, .video-container object, .video-container embed, .video-container video {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 100%;
}
</style>


-------------------------------------------------
Let me know your thoughts and questions in the comments.
Email: vyasankit2008@gmail.com

No comments:

Post a Comment