I would like to find out the php code where you able to embed the thumbnail from a youtube video to a website and when you clic on the thumbnail the video starts to play. All of this one using a shortcode (php) to add within of the post and typing into this shortcode the Video ID (got from Youtube) that you want to post. I have tried the follow code but it does not work and not include all my needs shown above.
Finally, I would like to join the shortcode shows below with [video] shortcode available for Wordpress, because I want to change the video player to the built-in WordPress player, which doesn't have the familiar Youtube styling.
Also, I searched the internet and I did not find all neccesary information
May you help me? Thanks in advance.
PHP Code:
function mininaturas_youtube($atts) {
extract(shortcode_atts(array(
'id' => '',
'img' => '0',
'align'=>'left'
), $atts));
$align_class='align'.$align;
return '<img src="http://img.youtube.com/vi/'.$id.'/'.$img.'.jpg" alt="" class="'.$align_class.'" />';
}
add_shortcode('miniatura_youtube', 'miniaturas_youtube');
To be added within of the post:
[miniatura_youtube id="3Jt7-nBfULU" img="0" align="center"]