At SunriseWeb.ca we have switched almost exclusively to building websites powered by the WordPress CMS. With the release of WordPress version 3.0 in early summer 2010 this open source CMS (Content Management System) has the potential to corner the website market – watch out Drupal and Joomla! One of the big reasons for this is the ability to quickly and easily create plugins to extend WordPress capabilities, and easily install and configure them.
As part of a recent project for one of my clients I needed the ability to display a YouTube channel feed – as new YouTube videos are posted to the client’s channel they wanted them to appear automatically in their website. It didn’t take me long to find a WordPress plugin that might do the trick – “WP Youtube channel gallery“. Since I’m writing my own reservation system plugin for another client I decided I would take a peek at the source code for the YouTube channel gallery plugin to see what I could glean from it.
I noticed that a deprecated function was being used to create the widget to display the YouTube videos and decided to replace it. This opened up some more options:
- getting rid of the config page for the plugin – just specify the channel name and number of videos to display in the widget
- add in new options to:
- specify the size of the video (e.g. the width in pixels and calculate the height based on standard YouTube aspect ratio)
- indicate if the video title should be displayed (since it overlays the video anyhow once it is played)
- add in a shortcode with the same options to allow embedding of the YouTube channel anywhere in a site’s pages and posts
I made the changes, sent them to the plugins’ author – Bruno Neves – and after some debugging the changes are live for download by anyone using WordPress. Special thanks to Bruno for using my changes, giving me credit and being open to collaboration!
Open source software really is amazing. The phrase “standing on the shoulders of giants” comes to mind. I can’t wait to write or collaborate on another plugin! Here are some screenshots of the WP Youtube channel gallery plugin in action:
Sample of “3 column” layout using shortcode with custom CSS in theme’s style.css file.
shortcode:
youtubechannel channelname="GoogleDevelopers" numvideos="9" width="175"
added CSS:
.wp_youtube_gallery {
position: relative;
float: left;
padding: 10px;
}
.wp_youtube_gallery h4 {
font-size: 0.5em;
display: none;
}
The YouTube video below is embedded using the JW Player WordPress Plugin to show that there are no compatibility issues between it and the YouTube Channel Gallery plugin.
[jwplayer file=”http://www.youtube.com/watch?v=fLQtssJDMMc” image=”https://sunriseweb.ca/wp-content/uploads/2011/01/nombray-domain-name-gift.jpg”]