Youtube Parameters

Posted in: Newspaper
Post count: 9

I want to pass parameters when I embed Youtubes videos.
For example do I want embed this video with parameters that turns on englisg captions.

youtube…. /watch?v=L9O8j9QPZc8&hl=de &cc_lang_pref=en&cc=1

My problem is that it doesn’t work, when I use in this theme.

Any ideas? suggestions,

Thaaaaaaanks

  • This topic was modified 12 years by danielnn.
Post count: 854

hi,
i doesn’t work because we recreate the youtube video link:
here is where the link recreation is made : http://screencast.com/t/fw3OVsiV76
we have addet this feature because you the theme support also short youtube links like:http://youtu.be/L9O8j9QPZc8

Thanks for you message.
Radu A.

Post count: 161

Daniel,

If you paste a youtube link in your post wordpress uses oembed to embed the video. So if you do not use your video as a featured video but want to show it within the post you need to manually iframe the video and add the parameters yourself. If you want oembed to automatically embed youtube links you need to create a custom function in your functions.php. Here is my function for example:

function Oembed_youtube_no_title($html,$url,$args){
    $url_string = parse_url($url, PHP_URL_QUERY);
    parse_str($url_string, $id);
    if (isset($id['v'])) {
        return '<iframe width="100%" height="393" src="http://www.youtube.com/embed/'.$id['v'].'?rel=0&autohide=1&?wmode=opaque&iv_load_policy=3&showinfo=0&vq=hd1080" frameborder="0" allowfullscreen></iframe>';
    }
    return $html;
}
add_filter('oembed_result','Oembed_youtube_no_title',10,3);

Just replace the ?rel=0&autohide=1& wmode=opaque&iv_load_policy=3&showinfo=0&vq=hd1080 part with your custom parameters and oembed will automatically embed youtube links that are pasted within a post. Reminder: you need to past the link via the WYSIWYG editor within your post WITHOUT a hyperlink. After pasting the link it will autmatically add a hyperlink, so be sure to remove it first. ALSO, you MIGHT need to update your posts (just open each video post and hit update) that already contain a youtube link for this function to take effect.

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