• I’ve noticed that the [embed] shortcode allows youtube video resizing, but not alignment. My wordpress site has several Authors now and i’d like their embedded videos to be centered in their posts, but obviously they can’t use unfiltered HTML to do this.

    I have a Twenty Ten child theme set up with a few basic changes in the style sheet. What change would i have to make to center all embedded videos?

    Also, is there a way to disable youtube options such as “Show suggested videos when the video finishes”? Normally that’s done by adding “?rel=0” to the video URL in the iframe code, but adding that to the URL in wordpress makes auto-embed stop working.

    Thanks in advance!

    [ Please do not bump, it’s not permitted here. ]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter X-Maj

    (@x-maj)

    I don’t really know what i’m doing so this is probably super clumsy, but adding this line to my stylesheet seemed to work:

    #content .entry-content iframe { display: block; margin: 0 auto; }

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    It depends on your code, but in general, margin: 0 auto (as long as the element is displayed block) does centre your element (within its parents element).

    Could you link to your website if this doesn’t work?

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    I’ve noticed that the [embed] shortcode allows youtube video resizing, but not alignment.

    Works for me just know. Is your child theme importing the parent theme’s CSS?

    Try surrounding your YouTube link with [embed] like so

    [embed]https://www.youtube.com/watch?v=dQw4w9WgXcQ[/embed]

    Then use the visual editor to center the line. The HTML editor view will show that as

    <p style="text-align: center;">[embed]https://www.youtube.com/watch?v=dQw4w9WgXcQ[/embed]</p>
    <p style="text-align: left;">How's this work?</p>

    The style="text-align: center;" should take care of it. I added the <p style="text-align: left;"> afterwards to out back left text alignment.

    Thread Starter X-Maj

    (@x-maj)

    Andrew Nevins:
    Yeah, it works fine. The only clumsy part is that it’ll probably center all iframes instead of just youtube embeds. If there’s a way to make that line of code specific to youtube embeds, that would be cool.

    Jan Dembowski:
    Centering embeds from the visual editor or HTML editor only works if your account has Editor privileges or higher. It doesn’t work for Author accounts.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How can Authors center video Embeds in a Twenty Ten child theme?’ is closed to new replies.