Founded in 2005, DailyMotion now has an Alexa score of 83 and is ranked as one of the largest and most profitable video sharing websites in the world. This article will show you how to embed responsive DailyMotion videos in WordPress with shortcode.
The site hosts pornographic content so visiting the service should be done so discreetly.
The result of our shortcode will render a video container as follows.
The video is responsive so will play nice on mobile devices.
To include the video on your post or page, you should do so by including the video ID (obtained from the URL), or the entire video URL, into our shortcode as follows:
[dailymotion v="x2nvui2" width="580"] or
[dailymotion v="http://www.dailymotion.com/video/x2nvui2_sir-james-galway-masterclass-practicing-scales_music" width="580"]
I've defined the video width into my shortcode. This wouldn't be necessary if the width was hard coded into your shortcode function. The height will automatically be determined and applied. If the height doesn't work for you, define it in your shortcode.
Copy and paste the WordPress function into your theme's
functions.php file or, if you sensibly have one installed, your custom functions plugin.
- You will find the video ID in the video URL. While you can use the entire video URL, best practice would have you only include the actual video ID in case the URL changes in the future.
- DailyMotion hosts an array of content you wouldn't normally see on commercial platforms such as YouTube. Because of the pornography-related material and what has been seen as ISIS propaganda, it isn't the best pick of website for your cat videos.