• With this theme anytime I attempt to use this in the functions.php it breaks. Trying to get my video embeds to be reactive on my website.

    Functions.php

    add_filter('embed_oembed_html', 'my_embed_oembed_html', 99, 4);
    function my_embed_oembed_html($html, $url, $attr, $post_id) {
      return '<div class="video-container">' . $html . '</div>';
    }

    Style.CSS

    .video-container {
    	position: relative;
    	padding-bottom: 56.25%;
    	padding-top: 30px;
    	height: 0;
    	overflow: hidden;
    }
    
    .video-container iframe,
    .video-container object,
    .video-container embed {
    	position: absolute;
    	top: 0;
    	left: 0;
    	width: 100%;
    	height: 100%;
    }

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter badincite

    (@badincite)

    Never mind I got it just drop it in the functions.wp-scripts.php instead

    Thread Starter badincite

    (@badincite)

    Anyway to limit the max size and keep the aspect ratio?

    Check out this page for using functions.php with Customizr. If you put the code into another php file, it will get overwritten at some point when you upgrade.

    Thread Starter badincite

    (@badincite)

    I actually didn’t have to mess with it I installed Responsive Video Embeds which wraps the embeds with <div class=”rve”> so I just added some css to my style sheet for rve and problem solved. However now i’m trying to find away to limit the size of all embeds and keep the responsive video size. Id like it to do what the twenty twelve themes does.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Wrap video embeds with div’ is closed to new replies.