WordPress Support

How To Set A Default Embedded Video Size In WordPress

Embedding Videos In WordPress Posts Can Be Tough!

Have you ever been frustrated by the way WordPress embeds videos in your WordPress Posts?  I have!

There’s over Radio Showin the FullContact Sites Course library, so I’ve got to be careful when I embed video tutorials.   I’m constantly checking to see if it will show up correctly on all types of devices like smartphones, tablets and notebooks?  What format should it be?  Can anyone steal the video… stuff like that.

I’ve also got to keep track of what plugin if any I’m using to embed or protect the individual videos.  For example JW Player uses a shortcode and the Amember billing and membership software uses a shortcode in each post to hide or show the content.   This makes it really tough to change directions with the technology your using in your WordPress site if you are charging for Memberships.

Luckily WordPress Made Video Easier…

Except when it comes to the default size that the videos get displayed at embedded.   If you aren’t sure about how embedding WordPress videos works now make sure to take the WordPress Mastery course (don’t worry it’s free).   The simple explanation is that if you add the URL to the video to the content of a post/page in WordPress it will be automatically embedded into the post/page.

There’s two simple things to remember about this though…

  1. The URL has to be by itself on it’s own line in the copy, preferably with a empty line before and after it.
  2. The URL must NOT be an active hyperlink, if it is remove the link before saving.

So everything seems easy right?

Not quite!  Depending on what theme you are using and where the video is hosted, think Vimeo or YouTube, the default dimensions of the video that gets embedded may be either too big or too small on your pages.

If you’re showing a head shot video that might not matter much but what about the screen capture videos that are common for sites that teach people how to do stuff like Radio Show?

The FullContact Sites Course library suffered from this problem.  the PageLines theme that we use embedded the lesson videos at only 320 pixels across – really tiny – which were way too small for screen captures so I had to figure out a way to get the videos to be embedded at least at 800 pixels across for the desktop version of the site.  (the mobile versions are already taken care of by PageLines and Vimeo)

So here’s today’s simple fix.

If you want to change the default size of the videos that get auto embedded by WordPress follow these simple instructions.

  • Find the “functions.php” file for your theme -In my case From the Admin Dashboard I went to the Appearance Menu and Selected Editor.
  • Select the Functions.php file from your theme as the file you want to edit.
  • Add the following line of code to the functions.php file in the editor.

if ( ! isset( $content_width ) ) $content_width = 800;

  • Change the 800 to the width that you want your video to be embedded at.
  • Make sure that there are NO spaces of lines after the ; character if this is the last line in the editor
  • Save your work!

Remember that your theme may have different ways to edit the functions.php file.  For example “Child Themes” often have their own menu item or plugin for settings like for the functions.php file.  If you’re not sure make sure to check with the theme author before you start.

Find Out How Deliver and Sell Courses Online In Less Than a Day …

Even If You're Pressed For Time & Hate Technology

FREE

Sell Your Courses Online

Your Step-by-Step Guide

FREE

Leave a Comment

Start Selling Courses Online

James Maduk

Build Your Own Training Site With WordPress!
Let Me Show You How To Create Your Own Training Site and Be Selling Courses Online In Less Than A Day... Even if you hate technology!

WPGrow