Embedding, resizing and centering YouTube videos in WordPress posts.

I got very much annoyed by the fact that when I was adding YouTube video links the player size was just bloody huge… I tried finding the solution for it and at first it seemed like I have 2 choices… WordPress shortcodes or some 3rd party plug-in recommended by few users. I don’t want to add a 3rd party plug-in so I got left with shortcodes… and they simply suck… Example? You can find this on their examples site:

[youtube=https://www.youtube.com/watch?v=JaNH56Vpg-A&w=320]

[youtube=https://www.youtube.com/watch?v=JaNH56Vpg-A&w=320]

and as You can see it does nothing of what its promising. It behaves like a politician after the won elections. It just sits there and does absolutely nothing…

It almost seemed like I am out of the options… and then I have found this… I tried it using the same video as above…

[embed width=320]https://www.youtube.com/watch?v=JaNH56Vpg-A[/embed]

https://www.youtube.com/watch?v=JaNH56Vpg-A

[embed height=320]https://www.youtube.com/watch?v=JaNH56Vpg-A[/embed]

https://www.youtube.com/watch?v=JaNH56Vpg-A

Results are promising…

It’s embedded and resized. Now… Let’s try centering… Wrapping the whole thing in:

<p style="text-align: center;">TheWholeThing</p>

<p style="text-align: center;">[embed width=480]https://www.youtube.com/watch?v=JaNH56Vpg-A[/embed]</p>

https://www.youtube.com/watch?v=JaNH56Vpg-A

So… Centering works…

Now lets try starting it at 20 seconds… adding:

&#t=00m20s

<p style="text-align: center;">[embed width=640]https://www.youtube.com/watch?v=JaNH56Vpg-A&#t=00m20s[/embed]</p>

https://www.youtube.com/watch?v=JaNH56Vpg-A&#t=00m20s

That works too…

So… Embedding? &#x2713 Resizing? &#x2713 Centering? &#x2713 Starting at a certain time? &#x2713

All good.

Cheers.

Andrzej

AndrzejL

"Never meet Your heroes. Most of the time you'll only end up disappointed." White Polak Male Husband Employee Hetero Carnivorous Fugly Geek @$$hole with ADD Catholic “Some men just want to watch the world burn.”

Comments are closed.