WordPress plugin intelligence profile

(MB) YouTube Widget

The YouTube videos widget lets you quickly and easily display your most recent YouTube videos in your blog's sidebar.

WP PlugIndex snapshot

Current directory snapshot

Tested up to WordPress 3.6
Current version1.05
WordPress coverageTested up to WordPress 3.6
Minimum stackWP 3.0 · PHP —
Directory statusactive
Last directory update2 Aug 201313y ago
Active installations50Adoption metric — not a quality score
WordPress.org rating3.7 / 5 from 3 ratings
Official packageDirect from WordPress.org

Repository metrics are context, not quality scores. Active installations measure adoption and can strongly reflect a plugin’s age and historical popularity. Ratings, recent updates and “Tested up to” metadata also do not guarantee modern code, error-free operation, security, feature completeness or suitability for a particular site. Why active installs don’t tell the whole story →

WP PlugIndex currently records (MB) YouTube Widget version 1.05 as active, updated 13y ago and tested up to WordPress 3.6.

Overview

About this plugin

The YouTube videos widget lets you quickly and easily display your most recent YouTube videos in your blog’s sidebar.

Features

  • The YouTube videos widget is fully-based on the WordPress Plugin API.
  • Uses hooks and filters to allow for maximum hackability by theme designers and developers.
  • Organized straightforwardly so that it’s easy to modify and style.

Usage

The YouTube videos widget is ready to use as-is, although you can easily customize it to your liking with a bit of code.

You can also insert a plain list of your recent videos into posts and pages with the shortcode mechabyte_youtube. For example, to load 5 videos from freddiew that open in new tabs, you’d use [mechabyte_youtube username="freddiew" videos="5" tab="true"].

Custom Styles

The YouTube videos widget loads it styles by hooking into WordPress’ wp_enqueue_scripts action. To remove the default styling you need to remove the our enqueue_scripts function from the hook.

remove_action( 'wp_enqueue_scripts', array( 'mechabyteYouTube', 'enqueue_scripts' ) );

Custom Output

The end user has two options of displaying their YouTube videos: in plain or decorated lists. When modifying the output of the plugin you must use one of two filters that this plugin uses: mbYT_construct_plain and mbYT_construct_decorated. Before you add your own functions to either filter, you must remove the default ones that are used automatically: mbYT_construct_plain_default and mbYT_construct_decorated_default.

remove_filter( 'mbYT_construct_plain', array( 'mechabyteYouTube', 'mbYT_construct_plain_default'), 10, 3 ); remove_filter( 'mbYT_construct_decorated', array( 'mechabyteYouTube', 'mbYT_construct_decorated_default'), 10, 3 );

Now it’s time to get creative. When creating a function that will loop through the videos you have complete control over how you want to display the content. Just keep in mind that in the end, you should be outputting <li> elements.

When filters are being applied to the YouTube content, there are three arguments that are being passed through: $youtube_videos ( array, the array of videos), $number ( integer, the number of videos the user wishes to display), and $tab ( boolean, a true/false value of whether or not the user wants to open video links in a new tab).

Keep in mind that you have access to the following pieces of information when creating your video loop:

$item['title'] // Video title $item['videoID'] // Video ID $item['viewCount'] // Video view count $item['published'] // Video publish date -- UNIX $item['duration'] // Video duration in hh:mm:ss $item['numLikes'] // Video likes count $item['link'] // Video link $item['image']['default'] // 'Default' thumbnail (low quality) $item['image']['mqdefault'] // Medium quality thumbnail $item['image']['hqdefault'] // High quality thumbnail

Here’s an example of some code that adds a custom function to our mb_construct_plain filter (assuming we’ve already removed the default functions). Keep in mind the 3 at the end. That lets WordPress expect our three arguments that will be passed through.

Check out WordPress’ add_filter() page for more info.

add_filter( 'mb_construct_plain', 'construct_plain_example', 10, 3 );

= '<a href="'.. = '</li>';

$i++; } return $output; }

Pretty basic, but it allows you to see a general example of how to loop through the objects and return the modified data.

The above code will produce a list element like this one:

v=3L-rrkyvApU" target="_blank">Real Life Portal Gun</a></li>

WordPress.org metadata

Plugin tags

Topics listed for this plugin in the WordPress.org directory.

  • recent videos
  • social
  • subscribe
  • youtube
Compatibility & maintenance

Compatibility & maintenance

Tested up to WordPress 3.6

Not yet marked as tested with WordPress 7.1. WordPress.org currently lists Tested up to 3.6.

Current WordPress releaseWordPress 7.1
WordPress.org Tested up to3.6
Minimum requirementsWordPress 3.0 · PHP not listed
Update activity2 Aug 201313y ago

“Tested up to” is directory metadata supplied by the plugin author. WP PlugIndex does not turn an older declaration into a claim that the plugin is incompatible.

Changes recorded by WP PlugIndex

Recent tracked changes

No tracked version or compatibility changes have been recorded by WP PlugIndex yet.

Tracking & source

WP PlugIndex tracks public WordPress.org directory metadata and records selected version, compatibility and availability changes as they are detected.

Plugin watchlist

Watch this plugin

Sign in to your WP PlugIndex account or create a free account. Free accounts can watch up to 5 plugins and see what changed.

Watch limit

Watchlist limit reached

You have reached your current active watch limit.