WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Help adding wmode=transparent to oEmbeds (16 posts)

  1. Number_6
    Member
    Posted 1 year ago #

    Hi. I'm using Buddypress with my WP installation, so a big part of the site is allowing people to simply paste a Youtube/etc link into their activity stream and have the video display.

    The videos hover over the chat bar and any other <div> object.

    People are overgrown children. They easily walk away from a site if the smallest thing bothers them. I put my blood, sweat, and tears into this project. I really need help or I'll just have a nervous breakdown.

    I've used snippets from 5 different sources that is supposed to manipulate the outputed iFrames the videos appear in. None of them work.

    I need to directly edit the oEmbed file in the wp-includes but I am in no way PHP literate.

    PLEASE PLEASE help me. I think I'm going to cry.

  2. I need to directly edit the oEmbed file in the wp-includes

    The oEmbed results are filterable so you probably do not need to edit any wp-includes files.

    Can you provide a detailed example of what you are trying to accomplish? As in how are you trying to edit the oEmbed results and from where? You want to add wmode=transparent but can you use the code button here to illustrate a before and after?

  3. Number_6
    Member
    Posted 1 year ago #

    <iframe width="640" height="480" src="http://www.youtube.com/embed/OWl01JD-CtQ?feature=oembed" frameborder="0" allowfullscreen=""></iframe>

    This is what the oEmbed outputs when a user inputs a youtube URL (not embed code) into BP activity stream (and I assume elsewhere, too).

    I don't know how it might look after, because I'm not entirely sure you can add a wmode parameter to an iFrame.

    Basically what I'm trying to achieve is similar to a z-index="0" so that it doesn't obscure <div> object on the page (e.g. WP Admin bar). I just haven't the first clue how to do this.

    Thanks for your reply.

  4. <iframe width="640" height="480" src="http://www.youtube.com/embed/OWl01JD-CtQ?feature=oembed" frameborder="0" allowfullscreen=""></iframe>

    That's a good before and really helps.

    Basically what I'm trying to achieve is similar to a z-index="0" so that it doesn't obscure <div> object on the page (e.g. WP Admin bar). I just haven't the first clue how to do this.

    My z-index="0" and CSS is shall we say "not that good", can you provide an example of how the final output might be? For example (and probably not correct) like this

    <iframe width="640" height="480" z-index="0" src="http://www.youtube.com/embed/OWl01JD-CtQ?feature=oembed" frameborder="0" allowfullscreen=""></iframe>

    That's probably doable via a filter but I just want to see what the results should be first.

  5. Number_6
    Member
    Posted 1 year ago #

    Right! I've found what I need!

    <iframe width="640" height="480" src="http://www.youtube.com/embed/OWl01JD-CtQ?wmode=transparent" frameborder="0" allowfullscreen="" wmode="Opaque"></iframe>

    After the ID of the video the variable ?feature=oembed isn't needed. I found a thread on Stack Overflow that suggested the variable ?wmode=transparent and a parameter wmode="Opaque" in the iFrame tag itself.

    So how do I add this to the filter?

  6. Hold please and I'll take a look. ;)

  7. Take a look at this pastebin.com link.

    http://pastebin.com/jKP4xABd

    One of my favorite toys is preg_match_all() to the point where I make all problems a nail to work with my hammer. I also like to reuse my code. ;)

    Download that text to your wp-content/plugins directory and name it youtube-wmode.php then visit your WordPress dashboard and look for a plugin named YouTube wmode adjuster.

    Activate that plugin and clear your browser cache as well as any server side cache like WP Super Cache or W3TC. Then visit a post with embedded YouTube and look at the HTML source.

    Hopefully you should see ?wmode=transparent and wmode="Opaque" in the HTML source. It's a very mechanical solution but it worked on my test installation.

    If something goes horrifically wrong (it shouldn't) then use FTP or whatever file management tools your host has provided you with to just delete that youtube-wmode.php file.

  8. Number_6
    Member
    Posted 1 year ago #

    <iframe width="640" height="360" src="http://www.youtube.com/embed/mtUvq82WkDY?feature=oembed" frameborder="0" allowfullscreen=""></iframe>

    No change.

    I assumed it had something to do with a lack of a PHP closing tag, ?>, so I reuploaded it with that included, with no change.

    Does that mean there's some plugin in operation that's preventing the oEmbed output from being altered?

    And as an aside: I've noticed some PHP files on pastebin end without a PHP closing tag. Why might that be? Never saw a PHP file without one.

  9. And as an aside: I've noticed some PHP files on pastebin end without a PHP closing tag. Why might that be? Never saw a PHP file without one.

    Because it's not needed and can cause problems if there is any blank space after the closing tag. If you are embeding <?php echo $some_value ?> in the middle of HTML then yes use the closing tag. But if it's in a PHP only file like that plugin then the closing tag is optional.

    Do you have a link I can visit to see? The regex should have worked for that YouTube embed.

    Edit: As an example you can see my test post here.

    http://dixie.dembowski.net/?p=4375

    I embedded that code by just pasting http://www.youtube.com/watch?v=OWl01JD-CtQ into the post.

  10. Number_6
    Member
    Posted 1 year ago #

    http://nagualgrove.com/

    The most recent Youtube video posted in the activity stream here.

    It seems there are some Buddypress plugins that enjoy stripping user content and alterations. This wouldn't be the first time for me.
    The thought of methodically deactivating plugins and posting video URLs one by one is hurting my temporal lobe.

  11. I think I see what the problem is, that's not a regular post and isn't hitting the_content filter.

    How are you adding those YouTube videos? Is it via the post editor or via some other functionality?

  12. Number_6
    Member
    Posted 1 year ago #

    http://wordpress.org/extend/plugins/buddypress/

    Buddypress, social networking plugin. Or should the posts on this go through the_content anyhow?

  13. Number_6
    Member
    Posted 1 year ago #

    Posting a youtube video into a regular WP post does not generate an oEmbed. I use "WordPress Video Plugin" and it's shortcode for embedding videos.

    http://nagualgrove.com/2013/01/hgyuuy/

  14. Number_6
    Member
    Posted 1 year ago #

    For the sake of others who may want to use this nifty plugin with BP Activity Streams, I'll share the changes I made.

    Very simple, I added this (new line under line 22):
    add_filter('bp_get_activity_content_body','mh_youtube_wmode');

    Thanks to modemlooper on Buddypress forums.

  15. *Jan makes note to play with BuddyPress more*

    Glad that worked out. ;)

  16. Number_6
    Member
    Posted 1 year ago #

    Thanks to you, it did :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.