WordPress YouTube Widget

Number 7 in Widget-A-Day is a YouTube widget.

It'll display a YouTube video in the sidebar. Just enter the URL of the video, and it'll show in the sidebar. You can change the width and height, and make it autoplay or not.

Download youtube.zip

SVN Checkout
svn co http://svn.wp-plugins.org/youtube-widget/trunk

Default display:
youtbe1cropped.png

Admin panel:
youtube2cropped.png

Requirements

Installation

  1. Download youtube.zip
  2. Extract and upload youtube.php to the plugins/ directory
  3. Enable YouTube Widget in the Plugin admin panel
  4. In widget admin panel, place YouTube in the sidebar, and edit it to enter the YouTube URL, not the embed code

Download youtube.zip

86 Comments

  1. j says:

    Is there a way to use multiple instances of this? Or is there another plugin with that functionality?

    This question was asked above but I wasn't clear on the answer. thanks for this.

  2. haber says:

    The removing of the YouTube URL is quite dumb. It should be a reg-ex, but I got lazy. If anything is slightly different with the URL, even case wise, it won’t work right.

  3. hellows says:

    thanks. this is a nice plugin. do you know if you will be adding any extras. will the plugin be developed. a future which would automatically update you tube videos would be useful. thanks

  4. [...] YouTube Widget: Allows your users to show their latest YouTube videos on their sidebar. Great for all that travel footage! [...]

  5. Blake Tallos says:

    wow, dude.Thanks for the great plugin.:DD

  6. A Peterson says:

    Does your widget work on WordPress 2.7?

  7. sam says:

    No, Man its not working

  8. Mark says:

    HI, thanks for the plugin, I have a problem with it as it show me this error:

    Warning: array_slice() expects parameter 1 to be array, null given

    were all the errors in the php have this:

    $items = array_slice($feed->items, 0, $maxitems);
    foreach ($items as $item)

    any help?

    Running WP 2.6.5

  9. James Wilson says:

    @Mark, what? array_slice and $feed are never used in this plugin.

  10. Mark says:

    James, My apologies, wrong plugin…glad to find out!

  11. LimiGuy says:

    I saw this question before but didn't see an answer. Is there any way to get this widget to go up on a sidebar more than once?

    Great widget!

  12. It seems your plugin has just stopped working on every site I had it on. Once example, http://www.vmsphotography.com when you goto the pages, there is suppose to be a youtube video that is in the top left corner.

  13. nish says:

    I would like to use this plugin as want display only on certain pages? some sort of if{condition} any help or guide pls?

    Thanks

  14. Billy Brasov says:

    Thanx for this useful plugin!

  15. monica says:

    It gives me the following error:

    Fatal error: Call to undefined function: str_ireplace() in /var/www/vhost/mas-memory.com/home/html/somos/wp-content/plugins/youtube.php on line 111

    How can I fix this?

    Thanks

  16. Ben says:

    I know this isn't a great fix, but for multiple instances of this plugin, I just copied the plugin file, went through the whole code and replaced every "youtube" into "youtube2" in all the code and everything. I then uploaded the copy in to the plugins folder and activated my new "Youtube2" plugin. Not a great fix, but I only needed two instances of it anyway.

  17. Ben says:

    Nish: try Widget Logic for your condition request. It'll add a widget logic field on the bottom of all plugins. You just need to know the page/post id # and then type in 'is_page(id_number_here)' without the quotes. You can find the plugin here: http://wordpress.org/extend/plugins/widget-logic/

  18. Ole says:

    Doesn't work.

  19. Vince says:

    Hi James,

    Just downloaded and uploaded this Plugin.
    It's activated in the PLugins section.
    Under the Widgets section it appears but it wont let me 'add' it to the sidebar as the 'Save' button disappears and therefore wont allow me to save or activate it.
    I've tried doing it a few times but cant get it to work.

    I have Wordpress version 2.7.1 on the site that I have currently installed this plugin.

    What should I try??

  20. barbara says:

    Hi James,
    I downloaded your You Tube plugin, but Í've got problems using it. I'm using the fusion theme. At the widgets page the YouTube widget is shown. If I click on 'add', the 'current widgets' disappear, and the "save chacges button" as well. Do you have any idea how to solve this problem?

    Thanx in advance, Barbara

  21. JDE says:

    Hi,

    Am trying to load your youtube widget to the site. Will it work with WP 2.7.1? If not, is there another youtube widget you could recommend.

    Thanks

  22. Fredrick says:

    Thanks for this great widget. I have it working on my website.

  23. Charles says:

    Am running WP version 2.8. Cannot drag from available widget column to the sidebar. Any comments on what to do??? Thanks

  24. mark woeppel says:

    I'm having the same issue. Cannot drag to the sidebar. Any help?

  25. Ben says:

    Sorry James…

    I used this widget for a week before I realized that I could accomplish the same exact thing by using a regular text widget and putting the embed code from youtube into it. It was much easier to use, I can have multiple instances and I know that it will always be compatible.

  26. kalista says:

    Thx for the widget, anyway, is it valid xhtml?

  27. Andy R says:

    Ben,

    Care to share your code so James and the rest of us can see how to do this?

    Andy.

  28. chris says:

    I see others w/ same problem – your widget will not drag to sidebar.

    pasting you tube code to text widget doesn't work either. I'm missing sometuning here

    paste code to text widget and all sidebars disappear.

    I find that the kiss of death when you geeks tell me how easy it is.
    The more you use the word 'easy' the more trouble I'm in.

  29. chris says:

    Do you have a more specific-extended list of instructions to install
    for those of us who are not as smart as a fifth grader?

  30. Andy says:

    I installed this but I was getting 'call to undefined function str_ireplace(). This function is only available in php5. So I went to plugin editor, and changed str_ireplace to str_replace and it worked (str_replace IS php4 compatible)

  31. Justin Moser says:

    just a quick question, ive installed this plugin and used the widget in my sidebar, only thing bugging me is that the thumbnails and titles are left aligned…ive tried styling all the and elements of the widget in my css file and aliging them to center and auto margins etc but nothing seems to work…any suggestions?

    Thanks a lot :)

    Justin

  32. All electric says:

    it's better to put it into code.

  33. Umair says:

    Hey James.
    thanks for the plugin dude but can you tell me if i would be able to add multiple videos?

  34. Michal says:

    Had the same problem as Andy (September 18, 2009 at 7:23 am) and the replacement of str_ireplace to str_replace worked perfectly.

  35. Does your widget work on WordPress 2.7?

Leave a Reply