I have some code in functions.php which adds options to my YT links. I want the same for my soundcloud. Is there any way to control this from functions.php? And if possible move adding video-frame only for YT videos.
Also soundcloud doesn't embed without including it in functions. Is it normal?
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="100%" src="http://www.youtube.com/embed/'.$id['v'].'?rel=0&theme=light&showinfo=0&iv_load_policy=3&vq=hd720" frameborder="0" allowfullscreen></iframe>';
}
return $html;
}
add_filter('oembed_result','Oembed_youtube_no_title',10,3);
function alx_embed_html( $html ) {
return '<div class="video-frame">' . $html . '</div>';
}
add_filter( 'embed_oembed_html', 'alx_embed_html', 10, 3 );
add_filter( 'video_embed_html', 'alx_embed_html' ); // Jetpack
function add_oembed_soundcloud(){
wp_oembed_add_provider( 'http://soundcloud.com/*', 'http://soundcloud.com/oembed' );
}
add_action('init','add_oembed_soundcloud');