Last active
January 18, 2016 10:26
-
-
Save vasylpb/b2bb1d56d677b467ca04 to your computer and use it in GitHub Desktop.
Wordpress shortcode example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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