Theme Support Forum

Support Forum for Free and Premium Themes. Premium Theme Forums are Private! Please log in first to see the Premium forums

If you Like the Asteria Lite Theme and want to Keep it free forever Please Rate it on Wordpress.org (It only takes a few seconds)
Viewing 14 posts - 1 through 14 (of 14 total)

Embed responsive youtube video

Home Forums Free Theme Support Asteria Lite Embed responsive youtube video

  • #91858

    Juan Cholbi

    Hello, I embed the youtube videos in my blog with this code [youtube=http://www.youtube.com/watch?v=xxxxxxx]
    but it is not responsive when I check it in ipads and iphones.
    How can I make it responsive?

    #91976

    Towfiq I.

    administrator

    the responsive youtube video shortcode is only available in the PRO version.

    #97849

    Jenny Lambert

    Bonjour,
    Hi,

    The embed responsive youtube video not working. on the wordpress Asteria pro theme y buy. Find nothing on the forum to help me ? Look easy at the bigining but nothing appear on Frontpage ant post when i use the asterai video thumbnails.

    My site here :http://www.jinnystudio.com/
    My video here: http://www.youtube.com/watch?v=fuPRHV2VVpU&list=UUL6A2zEg4px3hKzirBry3tQ&feature=c4-overview

    Since i read and understand better English the write it can you help !!!!! 🙂
    Merci,

    #97851

    Towfiq I.

    administrator

    try adding this to your post:

    [youtube width="100%" height="100%" autoplay="false"] https://www.youtube.com/watch?v=fuPRHV2VVpU[/youtube]

    #98571

    Jenny Lambert

    Hello Bonjour again,
    Half way working! 🙂
    Now I see my video on the post but not on front page thumbnails. By the way I see something…Wierd ?
    I try differnet thing like no youtube url in the asteria video thumbnails and nothig apear either.
    Thank for the support and hope you find a way to correct the problem.
    site:http://www.jinnystudio.com/
    post video for the front page: http://www.jinnystudio.com/2014/02/26/test-video-1/

    Have a nice day
    Bonne journée,

    #98768

    Towfiq I.

    administrator

    Jenny make sure you video url starts with https:// instead of http:// and remove everythng after &

    #99316

    Jenny happy

    Ca marche !!!!

    Well don !

    Merci et une bonne journée

    #382121

    Matthew Ebel

    subscriber

    So this shortcode can’t be used with shortened YouTube links (i.e. https://youtu.be/…) OR to embed playlists? That is a MAJOR shortcoming. How can I adapt this shortcode to embed playlists? (i.e. https://www.youtube.com/watch?v=ltR4snOdSwI&list=PL1EEA8D333FA0371B )

    #383957

    Towfiq I.

    administrator

    Sorry matthew, the shortlinks are not supported yet. You can use the playlist link instead of the youtube link like this:

    [youtube width="100%" height="100%" autoplay="false"] https://www.youtube.com/watch?v=ltR4snOdSwI&list=PL1EEA8D333FA0371B[/youtube]

    Thanks

    #384324

    Matthew Ebel

    subscriber

    …except that doesn’t work.

    All I get is an error from YouTube:

    http://matthewebel.com/wp-content/uploads/2014/11/Screen-Shot-2014-11-12-at-10.15.44-PM.png

    #384327

    Matthew Ebel

    subscriber

    The iFrame that gets implemented is this:

    <iframe class="vid_iframe" style=" width: 100%; height: 100%;" src="//www.youtube.com/embed/ltR4snOdSwI&list=PL1EEA8D333FA0371B?autoplay=0" allowfullscreen=""></iframe>

    At http://matthewebel.com/geek it’s implemented as this:

    <iframe width="600" height="394" src="//www.youtube.com/embed/ltR4snOdSwI?list=PL1EEA8D333FA0371B" frameborder="0" allowfullscreen=""></iframe>

    Notice the & and ? placements, I’m pretty sure that’s what’s breaking it.

    #389079

    Towfiq I.

    administrator

    No. its not that. the playlist requires different code. Open up shortcodes.php and replace this:

    function thn_youtube_func($atts, $content) {
    
    	//extract short code attr
    	extract(shortcode_atts(array(
    		'width' => '100%',
    		'height' => '100%',
    		'autoplay' => 'true',
    	), $atts));
    	
    	$content = strip_tags($content);
    	$content =str_replace('http://www.youtube.com/watch?v=', '//www.youtube.com/embed/', $content);
    	$content =str_replace('https://www.youtube.com/watch?v=', '//www.youtube.com/embed/', $content);
    	if ($autoplay == 'true'){
    		$autoplay= 1;
    		}elseif ($autoplay == 'false'){
    		$autoplay= 0;	
    		}
    	$return_html = '<div style="clear:both;"></div><div class="ast_vid"><div class="responsive-container"><iframe class="vid_iframe" style=" width: '.$width.'; height: '.$height.';" src="'.$content.'?autoplay='.$autoplay.'" allowfullscreen></iframe></div></div>';
    	
    	return $return_html;
    }
    add_shortcode('youtube', 'thn_youtube_func');

    with this:

    function thn_youtube_func($atts, $content) {
    
    	//extract short code attr
    	extract(shortcode_atts(array(
    		'width' => '100%',
    		'height' => '100%',
    		'autoplay' => 'true',
    	), $atts));
    	$content = strip_tags($content);
    	if (($pos = strpos($content, "list=")) !== FALSE) { 
    		$listid = substr($content, $pos+5); 
        	$content ='//www.youtube.com/embed/videoseries?list='. $listid;
    	}else{
    		$content =str_replace('http://www.youtube.com/watch?v=', '//www.youtube.com/embed/', $content);
    		$content =str_replace('https://www.youtube.com/watch?v=', '//www.youtube.com/embed/', $content);
    	}
    	if ($autoplay == 'true'){
    		$autoplay= '?autoplay=1';
    		}elseif ($autoplay == 'false'){
    		$autoplay= '';	
    		}
    	$return_html = '<div style="clear:both;"></div><div class="ast_vid"><div class="responsive-container"><iframe class="vid_iframe" style=" width: '.$width.'; height: '.$height.';" src="'.$content.''.$autoplay.'" allowfullscreen></iframe></div></div>';
    	
    	return $return_html;
    }
    add_shortcode('youtube', 'thn_youtube_func');

    let me know.

    Thanks

    #389080

    Matthew Ebel

    subscriber

    Yup, that worked. Thanks a bunch!

    #623284

    rampatter

    Check this one…..make your youtube video responsive

    Patter

You must be logged in to reply to this topic.