The best way to insert videos into WordPress posts on your site

How to insert video clips in your WordPress posts and control autoplay, looping and more

Videos are good for your blog or website for several reasons and if at all possible, you should include them in your posts. What are the advantages and what is the best way to insert them?

The advantages of videos

Plain text is visually boring and it is hard to make a post on a website look good and attract visitors. One look at a page full of text and some people will quickly disappear.

Images are a great help because they are visually attractive, they break up long passages of dull text and can something show sometime better than a written explanation.

A video clip is often better than a photograph or illustration because it can show people how to do something or what something is like. The view can almost experience it in a way that text and images cannot.

A video also increases the time that people spend on your page and on your site, which is good for SEO. If people stay on a page, it means they are more interested than if they visit and then quickly disappear.

Even if people don’t watch the whole video or even if it is a short video of only a minute or two, it is an improvement over the short period of time some people spend on a page of text or text with images.

Video is good for your site.

Don’t store video on your site

WordPress enables video to be uploaded and stored in the media library and it is probably the obvious place to put it. It can then be inserted into posts like any other media, such as a photo.

However, it is a bad idea to store video on your site for these reasons:

Video takes up a lot of space: Short videos require tens of megabytes of storage space and long videos require hundreds of megabytes, especially if the quality is high, like HD (1920 x 1040 pixels).

Usually the amount of storage space on the server is not a problem, but you might right out if there were a lot of videos. It would certainly make backups very slow and consume a lot of space.

Streaming video uses resources: Streaming video to visitors to your site puts a lot of work onto the web server. A popular page might have several people watching the video at the same time and, depending on your hosting plan, this might use too much CPU or RAM. These resources are usually limited.

Store video on YouTube and other sites

The best place for storing video is an online video service and YouTube is the best known of course, but there are others such as Vimeo.

A Google account (Gmail for example), is used to sign into YouTube and the camera icon in the top right corner is used to upload a video. Drag a video clip from the computer’s disk and drop it on the browser window to upload it.

YouTube upload video

There is no limit to the videos that can be uploaded to YouTube and the site will happily store them for free. No resources on our website are used, yet as we will see, it looks like the video is hosted on your site. You can include videos in posts without the hassle of storing them.

When uploading videos to YouTube, the default is to make them Public, which means anyone can find them using the site search feature. Usually this is a good thing and you can include a link or information in the video or accompanying text to send people to your website. It can be a source of traffic.

YouTube video upload options

If you prefer not to let YouTubers find and watch your videos, set them to Unlisted. This hides them from the site search facility so that no-one can find them. It does not make them private but is the next best thing. The only people that can watch unlisted videos are people you give the URL to or who visit your website.

Do not select the Private option because this prevents people from watching your videos without an invitation from you.

The downside of storing video on YouTube is that you must abide by Google’s rules. They are sensible though and you probably don’t want to post adult content anyway. The rule you are mostly likely to fall foul of is copyright music. The audio of every video you upload is analysed for music and the video is blocked if it is copyright. Even if it is very quiet in the background and very short.

How to insert video clips into posts

If the video is stored in the WordPress media library then just insert it just as you would insert an image. I hope I persuaded you to store it elsewhere, such as YouTube though.

Any YouTube video can be embedded into a WordPress post simple by typing or copying and pasting the URL from the YouTube page onto a blank line.

Go to YouTube and click the Channel link in the sidebar to open your personal channel. Your uploaded videos are listed. Click a video and then copy the URL from the browser’s address box.

Paste it into a WordPress post like this:

Well, I would show you the URL, but as soon as it is pasted in, it is magically converted into a video player! This is brilliant and it may be all you need to use video clips in your posts, but there are extra features you might want to use as well.

Advanced features for video posts

Switch to the text tab after inserting a video and find that URL you pasted in. There is an alternative way to insert the video and this enables some advanced features to be used.

A plain URL pasted in works fine, but the video could be embedded with a shortcode like this on the Text tab:

[ video src=”https://www.youtube.com/watch?v=CVW4M-T6MlA” ]

(Note: I put a spaces around the square brackets [ and ] in shortcodes to stop WordPress executing them. When you use shortcodes, don’t include the spaces. If you want to talk about shortcodes in posts, include spaces.)

By using a shortcode like this in the Text tab of the the WordPress post editor, we can add some optional extra parameters like this:

[ video src=”https://www.youtube.com/watch?v=CVW4M-T6MlA” loop=”on” autoplay=”on” ]

loop=”on” means the video repeats forever, or at least until the user stops it. This is useful for short videos and it could be used as an alternative to an animated GIF for example.

autoplay=”on” means the video automatically begins playing as soon as the web page appears. Think twice before using this because it can be seriously annoying. It is often used by adverts and we all know how irritating autoplaying video ads can be. However, it is up to you and it might be useful on occasions.

WordPress and the web browser work together to automatically set the optimum width and height for the video. It will automatically resize to fit small screens, such as phones and there is nothing you need to do.

However, it is possible to set the width or height manually like this (replace URL with the YouTube URL).

[ video src=”URL” width=”600″ ]

[ video src=”URL” height=”400″ ]

It is best not to set widths or heights because you don’t know the size of the reader’s screen. Omit them and let WordPress and the browser figure it out.

The first frame of the video is shown by default, but it is possible to specify an alternative cover image using the poster attribute. Add it to the end as with the other attributes

[ video src=”URL” poster=”/wp-content/uploads/image.jpg” ]

All this video magic is possible without using any plugins and all these features are built into WordPress. Many people don’t realise that they are there, or know they can insert a YouTube URL, but are not aware of the extra parameters like loop, autoplay and the cover image.

 


Affiliate links

Be the first to comment

Leave a Reply

Your email address will not be published.