How to Create Youtube and Vimeo videos embed shortcode in wordpress

Shortlink:

Videos Embeds

Today i will tech you how to create youtube and vimeo video embed shortcode in your WordPress websites.

just copy below shortcode and past in your functions.php page.


//Youtube Videos
function youtube($atts, $content=null) {
return ('<iframe width="560" height="315" src="http://www.youtube.com/embed/'.$content.'" frameborder="0" allowfullscreen></iframe>');
}
add_shortcode("youtube", "youtube");

//Vimeo Videos
function vimeo($atts, $content = null) {
return ('<iframe src="http://player.vimeo.com/video/'.$content.'"width="400" height="300" frameborder="0" webkitAllowFullScreen Mozallowfullscreen allowFullScreen></iframe>');
}
add_shortcode("vimeo", "vimeo");

Now you shortcode is youtube for youtube.com videos and vimeo for vimeos videos.

Youtube Shortcode

if you want to input any video from youtube then you need to youtube video id. example: if your videos link is youtube.com/watch?v=o2Crns6yy-I then your video id is ‘o2Crns6yy-I’ i mean after (v=) code. so you can use , example: then you can watching this video. this is support only dynamic post and pages create WordPress dashboard.

Vimeo Shortcode

if you want to input any video from vimeo then you need to vimeo video id. example: if your videos link is vimeo.com/watch?v=o2Crns6yy-I then your video id is ‘o2Crns6yy-I’ i mean after (v=) code. so you can use , example: then you can watching this video. this is support only dynamic post and pages create WordPress dashboard.

 

Note: Now if you want to input any video then don’t need any coding or using plugins, just input video direct link copy/past then automatic embed via WordPress. if you want then click here for more or this link

how to embeds youtube video, how to embeds vimeo, youtube videos embed in WordPress, vimeo videos embed in WordPress, youtube videos embed shortcode, vimeo embed shortcode, youtube and vimeo embed without plugins

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!




%d bloggers like this: