This topic has 2 replies, 3 voices, and was last updated 9 years by Abe.

  • Author
  • #47541
     gigidesign
    Participant

    How do you embed a youtube video in a post or page without the related videos after it finishes playing? The &rel=0 or ?rel=0 doesn’t work.

    #47584
     sharmstr
    Moderator

    I found this out yesterday when trying to force the resolution using the VQ=HD1080 parameters. The shortcode takes the link you supply and turns into an iframe tag. To do this, it only looks at part of the link and ignore the rest. I haven’t had a chance to talk to abe about this yet. I’ll assign this to him so he can see it.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #48635
     Abe
    Keymaster

    Hi, we have a function that adds other parameters to youtube oembeds and you could change that to include the rel=0

    You will need to copy the function to your kleo_child/functions.php file to override our defined one.
    Here is the modified function to use and see how it goes

    COPY CODE
    
    	function kleo_add_video_wmode_transparent($html, $url, $attr)
    	{
    		if (strpos($html, "youtube.com") !== NULL || strpos($html, "youtu.be") !== NULL) {
    			$info = "&showinfo=0&rel=0";
    		}
    		else {
    			$info = "";
    		}
    
    		if ( strpos( $html, "<embed src=" ) !== false ) {
    			return str_replace('</param><embed', '</param><param name="wmode" value="opaque"></param><embed wmode="opaque" ', $html); 
    		}
    		elseif ( strpos ( $html, 'feature=oembed' ) !== false ) { 
    			return str_replace( 'feature=oembed', 'feature=oembed&wmode=opaque'.$info, $html ); 
    		}
    		else {
    			return $html;
    		}
    	}
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

Viewing 3 posts - 1 through 3 (of 3 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?