I have had a really hard time embedding a video in my WordPress theme. After I just switched to a new theme, I could see the video in the text editor but it wouldn’t show up in the browser. I tried the iframe tag but it didn’t work at all. After trying lots of different code variations, finally I was able to get it to work by using this code, but I’m not sure it’s the correct code:
[video height="280" width="400" align="right" src="https://youtu.be/mhnuES3Zgr4"][/video]
I can’t seem to be able to float it to the right. Does anyone know how I would float it right? I’ve tried align=’right’ and style: alignright and I just can’t get it to work. Here is the url: camwoodbats.com
Thanks for any help!
Usually, you can just use oEmbed, which enables you to simply paste the URL to a video directly within a post or page, and WordPress will automatically handle embedding and sizing the video appropriately.
But, if you want to customize the size of the video, you’ll have to use the shortcode method, which is what you’re describing above.
Here is the full documentation for the video shortcode:
Unfortunately, as you’ll notice, there is no shortcode parameter for aligning a video to the left, center, or right.
So, your best bet is going to be to add some HTML to wrap your video in a box which is aligned to the right. You can only do this in the Text mode of the Editor, so be sure you’ve switched to that mode. Then, you might try something like this:
<div style="width: 50%; float: right;">
This example should embed your video, and float it to the right. We’re creating a box with a width of 50%, then positioning it to the right. In the box is the oEmbed URL for the video, which will allow WordPress to automatically embed the video(s), resizing to the fullest width of the enclosing box.
This should at least get you started.
You are a genius!! It worked! I have been trying to embed a video for two days.
So if I wanted to have two videos side by side on the same line, would I just use the exact same code underneath this code and change it to float: left?
By the way, on my last post, I had published some code in my response, and it just disappeared.. I guess the forum plugin ate my code:)
Thanks for all your help. I am going to check out your courses.