WordPress plugin: responsive YouTube embed
What the plugin does
Creates a WordPress shortcode [sdog-youtube-embed src=""]
, where the src
attribute is the URL of a YouTube video.
Why the plugin is useful
Copy an embed snippet from under a YouTube video (click Share > Embed), paste that into a WordPress page / post and it won’t be responsive out of the box.
To deal with that, add the shortcode above (into a shortcode block, if you have the new block editor enabled), and paste the URL of the video into its src attribute.
Note: make sure you copy the url with an /embed/
path, e.g. https://www.youtube.com/embed/DN6WTr9S6Rw
otherwise your browser may throw an error.
The plugin stylesheet will make the resulting HTML responsive. Credit where credit’s due on the CSS.
How users can get started with the plugin
Clone the repo and make whatever changes suit your task. Compress the directory into a ZIP archive and upload via your WordPress installation’s plugins Add New page. Activate, et voilà.
Where users can get help
Could I improve this? Send me a message, or find me on Github.
This is an example of the plugin at work:
Skillset
This project demonstrates the application of WordPress and Wordpress plugin development. Follow the links to see more projects using these skills.