If you want to display youtube video thumbnail on your website or WordPress blog, below is the code that you can use to do it. First, you need to create a shortcode by copying the code below and paste it into your functions.php file.
/* Shortcode to display youtube thumbnail on your wordpress blog. Usage: [youtube_thumb id="VIDEO_ID" img="0" align="left"] VIDEO_ID= Youtube video id img=0,1,2 or 3 align= left,right,center */ function wp_youtube_video_thumbnail($atts) { extract(shortcode_atts(array( 'id' => '', 'img' => '0', 'align'=>'left' ), $atts)); $align_class='align'.$align; return '<img src="<a href="http://img.youtube.com/vi/'.$id.'/'.$img.'.jpg"" rel="nofollow">http://img.youtube.com/vi/'.$id.'/'.$img.'.jpg"</a>; alt="" />'; } add_shortcode('youtube_thumb', 'wp_youtube_video_thumbnail');
Once done, you can use this shortcode and it only can accept 3 parameters: The video ID, the image size (0 for 480*360px, 1 for 120*90) and the image alignment
[youtube_thumb id="rNWeBVBqo2c" img="0" align="center"]
Tags: blogging