Embedding YouTube Video in your Wordpress Posts
We are often times asked which plugins we recommend for embedding YouTube video into a post. There are several to choose from, but since YouTube makes it so easy to embed video we prefer to paste the embed code directly from YouTube.com into the Wordpress HTML editor. Let's take a look at the procedure list we use and why we prefer this method over a plugin.
Procedure List:
- We begin by navigating to YouTube.com to locate the video we are embedding
- Next to the embed code, we click the “options” icon. By rolling your mouse over the options icon you should see the Customize tooltip.
- Click the icon and deselect the Include related links checkbox
- Also, deselect the show border checkbox.
- We also select the “Enable privacy-enhanced mode” checkbox
- Enabling this option disables YouTube.com from passing cookies to your site's visitors while they are viewing the video on your site
- Choose the size of the player
- Copy the embed code to the clipboard
Inserting into Wordpress
- Create a new div tag with a class=yt-video: <div class=“ytVid”> code </div>
- Paste the code from your clipboard between the opening and closing div tags
- Add this class to the end of your style.css or custom.css file for your template
- This file is located ./wp-content/themes/yourTemplate/yourTemplate.css
- Add some margin to separate the video from the rest of the content: .ytVid { margin: 15px; }
- The last step is to adjust the size of the video by changing the values of the objects width and height to your liking
- Note: You will need to change the object's width and height in two separate places in the code you paste from your clipboard
Why We Choose this Method
We prefer to manually embed YouTube video simply because it allows for greater control over the way video is displayed to the end user. Instead of searching for and overriding styles set for the plugin, we can set our own styles which can save a considerable amount of time. With fewer plugins to update, this approach also reduces the amount of maintenance required to keep the site up to date.








