My first released WordPress plugin

A screenshot of the gallery that the external video plugin creates

I’m pretty proud of this, which is why I’m dedicating a short blog post to it: today, John and I released my first WordPress plugin as open source to the WordPress plugins site.

It’s got the boring name “External Videos” and builds a bridge between your WordPress instance and videos of channels on a video hosting site – currently supported are YouTube, Vimeo, and DotSub.

It does this by using a brand-new feature to be introduced in WordPress 3: custom post types.

Check out the screenshots on the plugins page to see more – I’m unfortunately not yet running this Website with WordPress 3, so am not yet using this plugin’s features.

In the admin interface of WordPress, you enter the video channels that you want to pull videos from. Then it goes and pulls the videos with their metadata from these sites and creates video posts for them. That pulling is done once a day to update with new posts. The videos can be looked at in the admin interface under a separate video post section. They can be linked to WordPress posts and pages where the video may be discussed in context.

The video posts can be exposed on the WordPress site through a gallery, which is created by a short code, that can be added to any WordPress page. The gallery of thumbnails clicks through to an overlay with each video and its metadata as well as a link to the related WordPress post.

You can also add a widget to the side bar of the WordPress site with links to the most recent videos.

There are many more features that I want to develop for this plugin. I’d of course like to move it to HTML5 video instead of Adobe Flash. But for now I am happy with it.

I’d like to say thank you to John Ferlito, who helped with some of the coding, to Jeff Waugh for suggesting that it would best be developed using the new post types feature, and to Senator Kate Lundy and Pia Waugh at her office, who funded a part of the development. I am hoping they will find it useful to give their awesome collection of videos better exposure.

NOTE: you can post your issues with this plugin now to the wordpress forum at http://wordpress.org/tags/external-videos

35 thoughts on “My first released WordPress plugin

  1. Very nice, I’m a big fan of WordPress and it’s good to see new quality plugins getting released. Going to download and check it out, looks exactly like what I was looking for for weeks. So, thanks alot!

  2. It doesn’t work on WordPress 3.0 final version. Shows the following error if I hit the add new video button from channels:

    Fatal error: Call to a member function get_category() on a non-object in /home/site/public_html/videos/wp-content/plugins/external-videos/ev-video_sites.php on line 52

    Using 0.6 version of plugin.

    1. Hi Navjot – I haven’t actually tested it on the released version yet – will do over the next few days and fix the bugs. Thanks for noticing!

  3. One more observation..The videos do get imported but the error always comes. And next scheduled date always point to the Epoch date – January 1, 1970. It never points to the actual date/time for the cron.

    Also I would like to separate the embed code and description into separate variables….how to achieve that? I want to display the videos according to a custom template and it seems that embed code to display video and description are shown using single variable.

  4. Hi, I love this plugin so far very good work! However I would like the authorname in the gallerymode. How can I modify to do this? I tried a bit by myself but my php skills are not very good =)

    Also the “older videos” link doesnt work for me πŸ™

    Good work anyway very appriciated. I hope you keep updating!

  5. Hi,

    Your plugin is great and very useful, thanks for that! πŸ™‚

    I’ve just did a little modification, to filter the videos shown.
    I expect I can send you what I did, so maybe you could add that to your next version of the plugin.

    Regards,

  6. @Navjot I finally tracked down your problem with the wrong epoch date. Did you install the plugin manually and linked the directory? Cause that’s how I did it and was able to replicate that problem. I’ve fixed it in the code now, so the next release should have this covered.

  7. All: I have just posted a new version with many bug fixes at http://wordpress.org/extend/plugins/external-videos/ . This one works on wordpress 3, current release. So, please go test and enjoy. πŸ™‚

    Changelog:
    * fixed bug on get_category() being called on non-object (can’t test it though)
    * fixed bug on “attach” to post from external videos list to make it work again
    * fixed reports on cron time not working – damned, don’t believe the articles on how to use register_activation_hook!
    * included a new feature to remove all external videos post types in one go
    * fixed up the inclusion of video pages into tag and category management
    * now removes videos when a author is being removed
    * now deals with deleted videos on external hosts and removes them, too
    * fixed bug on “External Videos” tab on “attach video” for posts and pages

  8. Working on a website and found this plugin. I was so excited because this is (as far as I can see) the only plug in that has the ability to list out a youtube channel!

    Great job on this plugin. The workmanship and quality really shows =D

    But I have one issue T_T

    I’m using the short code and the gallery shows up just fine. But when I click on a video to watch it, nothing happens!

    The site is still in dev so yea =/
    http://legacysportscards.com/dev/wordpress/?page_id=382

    Again thanks for making my day ^_^

    1. Hi Luis,

      so, a thickbox is supposed to come up when you click on a video thumbnail. I can see that the thickbox CSS is included on your page and the thickbox per video also exists. However, I am getting some JavaScript errors on your page, also with a function called youTubeChannel:

      jQuery(“#videos”).youTubeChannel is not a function
      [Break On This Error] ,hideNumberOfRatings: false (line 167)

      And the function is in defined as:
      jQuery(‘#videos’).youTubeChannel({
      userName: ‘marcelbilak’
      ,hideNumberOfRatings: false
      });

      I wonder if that may be causing it. I don’t have such a function on my site.

  9. This is one of the best Word Press plugins I have ever used. Great job. Made my life much easier connecting You Tube channel to the website.

    Questio – there does not seem to be a support page, or forum? Can we set one up, or am I missing it somewhere? I have had a number of issues implementing this with my theme, most of which I have worked out, but things which I imagine would be common for anyone trying to do the same.

    An online resource would be helpful. Also, while I’m mentioning issues – how do we remove the “older videos” link on the top of the gallery? I don’t want that link there, only on the bottom. Editing the page template seems to do nothing as that code isn’t there. I can’t figure out where the gallery layout is being put together yet…thanks.

  10. Ah, ok, just answered my own question. For other people’s sake, here is solution:

    Edit > yourdomain.com/wordpressurl/wp-content/plugins/external-videos/ev-shortcode.php

    Find and delete this code (around line 99):

    <?php next_posts_link( __( '← Older videos’, ‘twentyten’ ) ); ?>
    <?php previous_posts_link( __( 'Newer videos →’, ‘twentyten’ ) ); ?>

  11. Sorry, forgot code tags, hopefully this shows…if not, should be obvious anyways.

    [code]

    <?php next_posts_link( __( '← Older videos’, ‘twentyten’ ) ); ?>
    <?php previous_posts_link( __( 'Newer videos →’, ‘twentyten’ ) ); ?>

    [/code]

  12. Another thought…a great addition to this would be a Facebook/social media “share” button for each video…not sure how to make it work though, because it would have to pass info to the social media site about that video specifically, not just the page…I’ll think of ways to play with it.

  13. @ryan Thanks for the comments and the praise. The plugin is being maintained at http://wordpress.org/extend/plugins/external-videos/stats/ , but we haven’t set up a forum because it didn’t seem necessary. Thus far, this blog post seems to have been the main way to communicate the need for new features – or emails directly to me. What would you prefer? We could set up a forum for discussion, though that might turn out fairly small. We could also set up a bug tracker instead. Is there any existing forum or bug tracker that you would like to see this added to? I could create a launchpad or sourceforge project and do it there? What are your preferences?

    @ryan as for the “share” button – that wouldn’t be hard to add at all. There are a lot of social bookmarking plugins or you can go directly and use http://www.facebook.com/share/ . You can then share the video page on your website with the embedded video. To share the original video from, say, youtube would be a bit harder.

  14. I’m trying to show a user’s whole channel as a gallery. But it seems to be picking only one to show, the oldest.

    http://beckylynntalks.com/blog/demos/

    The user’s channel on YouTube:

    http://www.youtube.com/user/beckylynnbeckylynn1

    I see all the videos in the External Videos in WP. The only one that shows is “Published”, and the other 3 are “Scheduled.”

    I can’t find anywhere to publish them.

    Thanks! Once I get it working, I think it will be the perfect thing.

    1. @Korina looks to me like it might be an issue with the time zones – maybe your blog runs on a different time zone to what youtube time is reported and thus the video seems to be created in the future. You should be able to open the external video element in your admin interface and change the published date if you want to adjust that. Let me know what you find. Maybe there is some code necessary to deal with time zones.

  15. Hmm. Odd. i couldn’t find anywhere in YouTube to change my timezone. The blog is set correctly.

    I also noticed that if you click on the thumbnail, it takes you to the post, but the video is not embedded — just the URL of it, followed by the description, and other information.

  16. Hi I have installed the plugin but I cannot get it to load my videos from my YouTube account? Any help would be gladly appreciated.

  17. I like the plugin so far, though I would really love it if I had control over how the videos were added into the array (specifically the post_type and category). Currently, everything gets added to “external-videos” and “External Videos” respectively.

    I would prefer to have the videos added according to the author’s id, not solely based on the plug-in’s name.

    http://www.mydomain.com/author-id/video-title
    http://www.mydomain.com/category/author-id

    Instead of only:
    http://www.mydomain.com/external-videos/video-title
    http://www.mydomain.com/category/external-videos/

    As almost every user plans on having multiple authors from different sources, this would provide a much more intuitive permalink structure, better SEO potential, and the ability to list the groups of videos by category.

    Thanks in advance, hoping for a feature update…

    Alan

Comments are closed.