I do not want to display the titles of videos I embed on my wordpress site. The way I’ve been doing this is using the embed link, inserting the iframe in the wordpress post and adding the custom Parameter “showinfo=0” to the end of the url. This has worked well, until I decided to change the design of my site. I have had to use some custom css to change all the videos (almost 200) that I’ve done that to in order to fit the new design. If I would have known of a way just to drop the link into wordpress (like most people do) I wouldn’t have had to use an iframe and wordpress would have adjusted the size of the video based on the setting entered in the media section.
I’m hoping there is a better way to embed a Youtube video than the way I’ve been doing it (It would be great to just drop the link into wordpress instead of having to go through so many different steps in order to get the video to show up. Does anyone have any ideas how (of if it’s even possible) to do this?
I post a video every day, so it would really help my process if there was a way to do this. Thanks.
`
<?php
load_theme_textdomain('standardtheme', get_template_directory() . '/lang');
$locale = get_locale();
$locale_file = get_template_directory() . '/languages/$locale.php';
if(is_readable($locale_file)):
require_once($locale_file);
endif;
add_theme_support('post-thumbnails');
require_once('admin/functions.php');
require_once('lib/standardtheme.php');
require_once('lib/pro-photo/pro-photo.php');
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="'.$args['width'].'" height="'.$args['height'].'" src="https://www.youtube.com/embed/'.$id['v'].'?rel=0&showinfo=0" frameborder="0" allowfullscreen></iframe>';
}
return $html;
}
add_filter('oembed_result','Oembed_youtube_no_title',10,3);
?>