function wptuts_youtube($atts, $content=null){
extract(shortcode_atts( array('id' => ''), $atts));
$return = $content;
if($content)
$return .= "<br /><br />";
$return .= '<iframe width="560" height="349" src="http://www.youtube.com/embed/' . $id . '" frameborder="0" allowfullscreen></iframe>';
return $return;
}
add_shortcode('youtube', 'wptuts_youtube');
Use the shortcode:
[youtube id="_ggWarwhv9M" ]Check out this video![/youtube]
Replace the Id with that of your video. Dimensions can be changed within the code.
[youtube id="_ggWarwhv9M" ]Check out this video![/youtube]
Replace the Id with that of your video. Dimensions can be changed within the code.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.