Skip to content

Instantly share code, notes, and snippets.

@vasylpb
Last active January 18, 2016 10:26
Show Gist options
  • Save vasylpb/b2bb1d56d677b467ca04 to your computer and use it in GitHub Desktop.
Save vasylpb/b2bb1d56d677b467ca04 to your computer and use it in GitHub Desktop.
Wordpress shortcode example
function my_video($atts){
extract( shortcode_atts( array(
'src' => $atts['src'],
'poster' => $atts['poster'],
), $atts ) );
$html='<div class="video_wrap">
<video id="movie" poster="'.$atts['poster'].'" preload="none" controls=""">
<source src="'.$atts['src'].'" />
<source src="'.$atts['src'].'" type="video/webm; codecs="vp8, vorbis"" />
<source src="'.$atts['src'].'" type="video/ogg; codecs="theora, vorbis"" />
</video>
</div>';
return $html;
}
add_shortcode('video', 'my_video');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment