Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

remove title & suggested videos from youtube link WordPress

  • SOLVED

I recently purchased the [[LINK href="http://shakenandstirredweb.com/theme/shaken-grid"]]shaken grid premium theme[[/LINK]] and when adding a youtube link it shows nicely in the grid display and larger in the details display.

I want to know what code I can put or add to remove the Title and Info as well as suggested videos from being displayed and where to put it.

<blockquote>Traditionally doing a simple embed I would add a line like so to the embed after the video id

?rel=0;showinfo=0

but I have no clue where to add this in this theme.
</blockquote>

I did find some mention of Youtube in the plugins.js on line 115 but this is beyond me & I'm not even sure this is the right place to be looking.

Thanks in advance.

Answers (5)

2012-10-29

Manoj Raj answers:

I have tried a simple workaround..Add this code to your header... I tried it and it works...

jQuery(function($) {
$('iframe[src^="http://www.youtube.com/"]').each(function(){
var tubesrc = $(this).attr("src");
$(this).attr("src", tubesrc + "&rel=0&showinfo=0");
});
});


sly comments:

works at first, but when video is done playing it resets itself to show the title. This is probably the cleanest method if you can sort out the reset.

Will test others now.


sly comments:

<em>*Note. Also when the page loads it initial shows the title then the video refreshes and doesn't show the title.</em>

2012-10-30

Christianto answers:

Hi Sly,

Regarding your questions on Manoj Raj's answer,
I think youtube video with "&showinfo=0" will hide the title but if video is done, the title/other info will appear again ( although when you click to play it, the info won't appear )

you can check it on: http://www.reelseo.com/youtube-player-info
it has the same "&showinfo=0" param, and same behavior.

2012-10-29

Arnav Joy answers:

can you show me where is video and you want to remove title from it?

2012-10-29

Navjot Singh answers:

Try this code in your theme's function.php

/**
* Add Custom Parameters to YouTube Embeds
*/
function namespace_oembed_youtube_no_title( $html, $url, $args ) {

// Only run this for YouTube embeds
if ( !strstr($url, 'youtube.com') )
return $html;

// Get embed URL
$url_string = parse_url($url, PHP_URL_QUERY);
parse_str($url_string, $id);

// Set default arguments
$defaults = array(
'width' => 480,
'height' => 385,
'showinfo' => false,
'rel' => false
);

// Merge args with defaults
$args = wp_parse_args( $args, $defaults );

// Define variables
extract( $args, EXTR_SKIP );

// Add custom parameter values to IFRAME
if ( isset($id['v']) ) {
return '<iframe width="' . intval($width) . '" height="' . intval($height) . '" src="http://www.youtube.com/embed/' . $id['v'] . '?rel=' . intval($rel) . '&showinfo=' . intval($showinfo) . '" frameborder="0" allowfullscreen></iframe>';
}

return $html;
}
add_filter('oembed_result', 'namespace_oembed_youtube_no_title', 10, 3);


[[LINK href="http://wordpress.stackexchange.com/questions/43198/any-way-to-use-a-custom-parameter-for-youtube-embed-without-using-an-iframe"]]Source[[/LINK]]


sly comments:

doesn't work.

2012-10-29

Abdelhadi Touil answers:

Hi.
If you post videos by just pasting youtube video link in the post editor, then you can use a free plugin called "Smart YouTube PRO" that I use always in my websites, and it's do all things you want easily and automatically:

[[LINK href="http://wordpress.org/extend/plugins/smart-youtube/"]]http://wordpress.org/extend/plugins/smart-youtube/[[/LINK]]

Good luck.