Easy Video Resizing - How to Center

Okay, so generally when we are in WordPress and go to YouTube and copy the YouTube URL for the video, it will look something like this:

And so, when I copy that and paste into WordPress (Visual Editor), it will automatically generate the standard aspect ratio and look great:

Now, that MAY be great for a video that's rather "stand-alone" and you don't mind it being left-justified.

Typically, I prefer the "embed" code instead which is obtained from YouTube by clicking Embed instead of Share:

You'll notice the code you are copying is a wee different. It's an "iframe" and also contains height and width.

But, because it's an iframe, you MUST switch to the TEXT editor and paste there. Don't paste into the Visual Editor. It won't work.

After pasting it in and add a Center code.

Here, I'll show you in two steps.

Step 1: Get the Embed Code for the Video

I went to the YouTube video and clicked embed. I then highlighted the line and copied it as the image indicates above. Then, I paste into the TEXT mode of my WordPress editor:

IF I switch back to the Visual Mode, this is what gives us that familiar grey box:

Now, again, you can click that wee square box at the lower right and drag it to resize. But, your aspect ratio will be off unless you're real sure of the numbers for hieght and width.

But, first, let me show you how to center IF the size if fine with you.

After you see the above, switch to the Text editor instead of Visual:

Step 2: Insert the Center code.

The beginning of the "Center" code looks like this: < center >

Then, you'll have your embedded iframe stuff that you copied before.

Then, close it up (or finish it) with this: < / center >

(no spaces) ..... so, in the TEXT mode, it appears as such:

NOTE: When you switch back to the Visual editor, it will still Appear to be left-justified. No worries. Save a Draft and Preview OR Publish and it will be centered.

Okay, so now you know how to use the embed code instead of having WordPress "render" the video automatically with just the link of the video from the Share option of YouTube.

Next, I'll show you the neat trick to picking the correct size automagically and not having to worry about the click and drag method where the aspect ratio might be sadly way off.



Join the Discussion
Write something…
Recent messages
Dfoxmd1215 Premium
Well done. David
Reply
PjGermain Premium
thanks again Doc!
Reply
Crittercraft Premium
Thank you so much! I don't mind coding at all if it is explained properly :-D You did a great tutorial!
Reply
PjGermain Premium
Awesome!!! Thanks so much!
Reply
Martstervt Premium
Keep em coming Peej, I went through it but will bookmark to aid my retention fallibilities.
Marty
Reply
PjGermain Premium
LOL! It'll be here for ya! ;-)
Reply
Martstervt Premium
ATSA Spicey Meatball::))
Reply
Yuko Premium
I just made my first YouTube video last week and this tutorial will come in handy soon for sure! Thank you so much PJ for creating great lessons for us as always. :)
Reply
PjGermain Premium
Awesome Yuko! You're gonna be a STAR !!!
Thanks so much!
Reply
Yuko Premium
Haha, you are too kind and the video is not even 4 min long, but you know what? I made it in English :) Yes, it was a big deal for me! lol
Reply
PjGermain Premium
4 minutes is good!! Too long and people get bored. I have found that 3.5 to 4:5 in length is the "sweet spot". I look forward to checking it out!
Reply
AlexEvans Premium Plus
PJ you are a star man, there are guys online selling the information you are bringing to the table, far out total legend. Thank you.
Reply
PjGermain Premium
HEYYYYY, there's a thought! ;-)
Thanks bro!
Reply
AlexEvans Premium Plus
Ah mite of just shot myself in the foot, keep it free for members of your fan club.lol
Reply
PjGermain Premium
LOL!!! Will do!
Reply
Top