Skip to:

Embedding YouTube and other media clips in 2.1

  • Jeaz



    In 2.1 bbPress can now parse YouTube links and embed them directly into the posts, which is a great feature.

    However, I’ve come across one problem, the width of the videos.

    The videos default to 640 width which is too wide for my content. In wordpress media settings I’ve entered that the content shouldn’t be wider than 500px but bbPress do not adhere to that setting.

    Also, since the embed add width and height inline, I can’t change it with CSS.

    The only workaround right now is to add &w=500 at the end of the YouTube link, but that’s not ideal for many reasons. First, it makes more complicated for my users to add video. And also, it means that if I ever change width of the forum in the future, 500 might not be the ideal width and I’d have to go over and change it all again.

    Not sure if I should put this as a bug in the trac. I certainly don’t mind doing that but don’t want to flood it unnecessarily.

Viewing 6 replies - 1 through 6 (of 6 total)
  • I’ll have to take a look and see why it doesn’t use the media settings.

    In the mean time all you need to do is something like

    #bbpress-forums iframe,
    #bbpress-forums embed {
    width: 500px !important;
    height: auto !important;
    margin: 0 auto; /* if you want it centered */



    Ah, many thanks. Silly me, I did one or the other, but never both iframe and embed at the same time.

    I had to set height to 312px though, or the aspect ratio got quite funny.

    Big thanks for the help!

    Hmm, I just tested and couldn’t reproduce the issue.

    I’m testing on 2.1 trunk and WP 3.4 trunk, so it’s possible has been fixed in one of those versions that you’re not running.

    Anyways, in Settings > Media I set the embeds max size to width 200, height 0 and it resized it correctly.



    I’m at the 2.1 (but haven’t updated from the trunk in a week maybe) but 3.3 release version of WP and then I enter the same thing into settings and nothing happens, unless I add the css you suggested.

    EDIT: It could be that my theme is causing some havoc as well. I had quite a lot of problems with it since it was designed for bbPress 2.0 table layout and not really ready 2.1 list layout.



    Thanks for this. Had the same problem a year later.

    I tried the solution but found it also affected an adsense iFrame (not sure why??). Anyway, I fixed that by being more specific,

    I used .youtube-player.iframe { … }

    Add it here in case someone else hits the same issue.



    I am facing the same issue!

    The embed YouTube Video width is cracking my page
    As far as I can see its embed with 920px

    Nothing seems to work here!

    What I already tried is to add
    if ( ! isset( $content_width ) ) $content_width = 500;
    to the functions.php of the Theme!

    Here are some information about my settings:
    WordPress 3.8.1
    Theme Graphene
    bbPress 2.5.3-5249
    bbPress-Columnmode : One Column

    Can anyone please help me out here?!

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar