Guide to Embed YouTube Video in WordPress?

Guide to Embed YouTube Video in WordPress?

YouTube is by far the most popular social networking platform across the globe. The platform is continuously dominating the entire digital world by storm. It is receiving more than one billion fresh views every month- this is something beyond the expectation of any digital marketing campaign. This achievement is encouraging website owners/webmasters to embed YouTube videos to their WordPress site for generating best possible outcomes.

Here in this blog post, we will light upon the process of incorporating YouTube Video into your WordPress site. After the inclusion of oEmbed support in WordPress 2.9, it becomes super-easy to achieve this task. Plus, there are several WordPress plugins that let you customize the look of your YouTube videos to give rich visual experience to your real-time visitors with ease.

So, let's get started!

Use oEmbed to add YouTube Video on a WordPress site

WordPress has an inbuilt shortcode called oEmbed that enables you to add multiple types of media from the Internet to the WordPress site, without ever using any code script or third-party plugins. It is a simple format that seizes a standard link, extracts media from it, and adds it on a web page. All you need to do is to add the URL of a video on a post editor and the YouTube video will be displayed automatically on your posts.

In fact, the newer version of WordPress offers a preview of a video so that site owners can see the changes in real-time before moving it to the live server. However, it becomes quite difficult to customize an added YouTube video with oEmbed.

For that, you need to muddle through the complicated filters, which is not easy for a beginner to implement. So if you don't want to customize your embedded video, then oEmbed is an ideal way to get started.

Use Embed Shortcode

If you are using the oEmbed method, then make sure you add the URL on its own line. If other content lies on the same line, it will be taken as a part of the added URL, and you will run into an error. Well, you can solve this by enclosing your video link in the embed shortcode.

Even on the same line, [embed] https://www.youtube.com/watch?v=4pWlwhdki3T [/embed],

Tip: The above shortcode will be embedded while adding your video URL to your WordPress post editor.

You can even scale up or down the height and width of your video using the embed shortcode. You can adjust the dimensions of your YouTube video by using the following piece of code:

[embed width= “300” height= “150”]https://www.youtube.com/watch?v=4pWlwhdki3T [/embed]

Tip: You can change the height and width of your video as per your requirements.

Use the YouTube Embed Code

This is one of the easiest and fastest ways of embedding YouTube Videos to WordPress posts. If you've used YouTube, then you might know that all the YouTube video has a share tab just below the title of a video. By clicking on this tab, you will see another tab as “Embed”. Once you hit the “Embed” tab, you will see a piece of iframe code that you can copy and paste directly into your posts.

To see more options, you can click on the More tab right underneath the title of your YouTube Video. You can click on this tab if you want to choose different dimensions of the same video. You can also select other features, such as the option to display other data such as video title or show player controls, etc.

Use Jetpack plugin to extend oEmbed

If you have already installed Jetpack plugin to your site, then you will get a plenty of existing options while using the oEmbed method. All you need to do is to go to Jetpack > Settings > click the Activate link next to “Shortcode embeds”. Once it enabled, you can begin appending parameters to your embedded URL.

For instance, oEmbed uses a default height and width (as mentioned above) when it adds a video. But with the help of Jetpack, you can change the width and height of your video by embedding “w=” and “h=” at the end of your URL.

[YouTube_URL]&w=1000&h=500

Through this, you can make further customizations to the URL as per your need. There are multiple strings that you can choose according to your specific requirements. For instance, If you want your video to remove related videos and use YouTube's light theme, then your URL would look something like this:

[YouTube_URL]&rel=0&theme=light

Tip: The “rel' attribute is set to zero to delete related videos from the end of a video. While the theme is set to light as per your wish.

Use other WordPress plugins to embed YouTube Video

YouTube Embed

If your website has more of visual content in the form of videos, then you should opt for a simple plugin that gives you more options than what a WordPress by default offers. It is a simple way of adding responsive YouTube videos into the posts and pages of your website on the fly.

You can even customize your video to make it more appealing and engaging. With the help of this plugin, you can do the following things:

  • Scale up/down the width and height of your video
  • Turn off the audio
  • Remove related videos
  • Delete controls
  • select a custom start and stop time, etc.

Lazy Load for Videos

Since the embedded YouTube video on WordPress loads other external files such as JavaScript or CSS, this can slow down the loading speed of your site if you have more than one video on each web page. This is where Lazy Load for Video plugin exists.

The plugin improves the speed of your site by replacing embedded YouTube video with a static image that's having a play button. Web visitors click on the image to play the YouTube video. This reduces the additional load of a video and accelerates the page loading speed of a web page.

Conclusion

The methods mentioned above in this post will help you embed YouTube videos into WordPress posts and pages become super-easy. With the help of YouTube videos, you can encourage more people to access your site and stay connected with it.

Posted by Lucy Barret

Lucy Barret
Lucy Barret works full time with WPGeeks Ltd. as PSD to Wordpress conversion expert. She loves to write about open source CMS and enjoys long vacations with friends.

Related Posts

Comments

comments powered by Disqus