Black Friday! Get up to 25% off GP Premium! Learn more ➝

Reply To: Change video embed size

Home Forums Support Change video embed size Reply To: Change video embed size

Home Forums Support Change video embed size Reply To: Change video embed size

#244987
Jessica

Somthing funky is going on with the responsiveness of videos. I have 2 nearly identical sites (I just changed the content and typography) but the CSS & function are exactly the same… the YouTube video is pasted into the page/post exactly the same, but on one site, the video isn’t responding.

the css is:

.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%;
	}

the function code is:

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

On the first (original site) the video link is simply pasted in with NO wrapper added. And the site identifies it as a video, and works great.

the second site, all using exact same methods, code, css, etc… the videos aren’t responding.

I am not going to be able to put an html wrapper around every video b/c there will be so many it will totally defeat the purpose of the action & css I used.

I’m baffled. The only difference between these 2 sites are the urls. Everything else is the same methodology. Help!?