Skip to content

Instantly share code, notes, and snippets.



Created Oct 30, 2014
What would you like to do?
Wordpress: Youtube + Vimeo shortcodes for responsive layout
function appthemes_add_quicktags() {
if (wp_script_is('quicktags')){
<script type="text/javascript">
QTags.addButton( 'yt_embed', 'Youtube', '[youtube id="', '"]', 'y', 'Youtube Video', 1 );
QTags.addButton( 'vm_embed', 'Vimeo', '[vimeo id="', '"]', 'v', 'Vimeo Video', 2 );
add_action( 'admin_print_footer_scripts', 'appthemes_add_quicktags' );
function youtube_shortcode($atts) {
extract(shortcode_atts(array('id' => 'KO8EPkgug4c'), $atts));
return '<div class="ytplayer"><iframe src="'.$atts['id'].'?controls=1&amp;autohide=1&amp;vq=hd720&amp;iv_load_policy=3&amp;rel=0&amp;showinfo=0" allowfullscreen=""></iframe></div>';
function vimeo_shortcode($atts) {
extract(shortcode_atts(array('id' => '12345678'), $atts));
return '<div class="vmplayer"><iframe src="//'.$atts['id'].'?title=0&byline=0&portrait=0&hd=0&autoplay=0" allowfullscreen=""></iframe></div>';
add_shortcode('youtube', 'youtube_shortcode');
add_shortcode('vimeo', 'vimeo_shortcode');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.