Embed YouTube Shorts 9X16

Posted in: Newsmag
Post count: 12

Hello, I have a question about embedding YouTube shorts into WordPress. When I copy and paste the code into the editor it looks like fine, it’s set to 9×16 with no black boarders. However, when I publish the post, the video switches to 16×9 with boarders. I hope that makes sense. When I deactivate Newsmag theme and use the default WordPress theme, there are no issues, works fine. Also, I have tried this same method on my dummy site with no plugins installed, same results.

Post count: 35449

Hi RedKobra, it is possible to be some extra code in the theme that is overwrite the default code for embeded Youtube shortcode. What it can be done in this situation is to use a stronger css that will use the default settings, for this I will need a link to a post/page that contains an embed youtue, or the link of the youtube short that you want to embed.

Thank you!

Post count: 12

Calin, thanks for your response. Sorry I haven’t responded quicker. Here is a link to one of the post I made with a YouTube short.

https://www.maddenguides.com/i-form-close-pylon-sail-cover-3-beater-madden-24/

Thanks,
Kobra

Post count: 35449

Hello,
What I can suggest is to try this custom css:
.single .mejs-video-container {
padding-bottom: 100%;
}
.mejs-video-container iframe {
height: 100%!important;
}

The code can be adjusted after your needs.
I hope this will help you!

Post count: 12

Calin, thank you very much. I added one more line up CSS to it which was

.mejs-video-container iframe {
width: 70%!important;

Works perfectly!!!!!, however, I would like to center it in the post.

I tried this css code,

.mejs-video-container iframe {
align-items: center important;

}

But didnt work. Can you help me, thanks

Post count: 12

Calin, never mind figured it out

position: absolute;
margin: auto;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);}

Been awhile since I used CSS.

Here is the final CSS code if anyone is interested

.single .mejs-video-container {
padding-bottom: 100%;
}
.mejs-video-container iframe {
height: 100%!important;

}

.mejs-video-container iframe {
width: 50%!important;

}

.mejs-video-container iframe {
position: absolute;
margin: auto;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);}

Thanks again for help,
Kobra

  • This reply was modified 2 years by RedKobra.
Post count: 35449

Hi RedKobra, I’m glad that you manage to find the css code you need!

Viewing 7 posts - 1 through 7 (of 7 total)
The forum ‘Newsmag’ is closed to new topics and replies.