Support » Plugin: YouTube Channel » [Plugin: YouTube Channel] Making use of WP oEmbed

  • This is a slight modification of the code for displaying html5 iframes to trigger the WP oEmbed hook. Just replace the lines 273 to 275 of youtube-channel.php with the following:

    $attr['discover'] = (apply_filters('embed_oembed_discover', false)) ? true : false;
    $oembed_html = wp_oembed_get("".$yt_url, $attr);
    // If there was a result, oembed the link
    if ($oembed_html) {
    echo apply_filters('embed_oembed_html', $oembed_html, "".$yt_url, $attr);
    } else {
    <iframe title="YouTube video player" width="<?php echo $width; ?>" height="<?php echo $height; ?>" src="<?php echo $yt_url."?wmode=opaque&enablejsapi=1"; if ( $controls ) { echo "&controls=0"; } if ( $hideinfo ) { echo "&showinfo=0"; } if ( $autoplay ) { echo "&autoplay=1"; } if ( $hideanno ) { echo "&iv_load_policy=3"; } if ( $themelight ) { echo "&theme=light"; } ?>" frameborder="0" allowfullscreen id="<?php echo $ytc_vid ?>"></iframe>

    This allows user defined functions to hook into the embed html. In my case I needed to strip the iframe width and height to make it work with a responsive design. This is not an ugly “hack”, it’s just enabling a standard hook of WP-core. I would suggest adding this to the next update. 🙂

  • The topic ‘[Plugin: YouTube Channel] Making use of WP oEmbed’ is closed to new replies.