How to add a video to a WordPress post or page

By April 25, 2017Ask Websy

A question that comes up a lot is “How do I upload a video to my website?” As I explain in the video below, the best thing you can do is upload it to YouTube or Vimeo instead, and then embed it on your site!

Plugin mentioned in video:

How to Make your Videos Responsive (Advanced):

Note: I do not recommend attempting the following unless you have some experience working with WordPress theme files.

In order to force your videos to use the full width of the space where you are embedding them, rather that showing a smaller size video that does not change its size for difference screens, you may have to add some code to your WordPress theme.

First, the following would need to be added to your functions.php file:

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

Then you need to add the following to your theme’s stylesheet:

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

Author Jenny

Jenny founded Websy Daisy way back in 2004, when she saw that there was a real need for custom web design for small businesses and small budgets. She has been working as a web designer and graphic designer for more than 15 years, and has created hundreds of web sites for entrepreneurs, authors, small businesses, artists, designers, and business professionals.

More posts by Jenny