TubePress is a PHP library that displays beautiful YouTube video galleries in your web site. It's highly configurable and easy to use. Check out a demo gallery here.
There are two different TubePress packages available:
Both packages are released under the GPLv3. TubePress was created, is developed and maintained by Eric D. Hough
svn checkout http://tubepress.googlecode.com/svn/trunk/ tubepress
svn update
TubePress can be installed and activated just like any other WordPress plugin. See the WordPress docs on plugin management for more information.
[tubepress]in a post or a page where you'd like to insert your gallery (this is actually the simplest form of a TubePress shortcode). See the image below for an example.
This will result in something like the following…
The options in Settings > TubePress are the global options for TubePress. The real power of the plugin lies in the ability to put multiple galleries on multiple pages. You can do this by using TubePress shortcodes on your posts/pages.
For example, say on one page I want to display a gallery of videos that are tagged with "football". On this page, I would type
[tubepress mode='tag', tagValue='football']
on the page where I want the gallery to show up. And say on another page I want to display a gallery with the default (global) options that were set in Settings > TubePress. On this page I would type
[tubepress]
where I wanted the gallery to show up. You can follow this procedure for unlimited galleries on unlimited posts/pages. Just use any TubePress shortcode to control the gallery content. Get creative!
Upgrading is usually just a matter of copying the latest version of TubePress over your existing installation. However, if you want to be sure there are no problems, follow these directions in order.
The TubePress plugin comes with widget functionality, which allows you to place a customizable list of videos in your blog's sidebar. Here's an example of the widget's output:
There are no separate installation instructions; if you've installed and enabled the TubePress plugin then you're done. Please see the WordPress widget documentation for general info on how to enable and disable widgets.
This is what the TubePress widget control looks like:
In the "Title" section of the widget control, enter the text you'd like for the sidebar's header.
To customize which videos show up in your sidebar, just use a TubePress shortcode. Please note that by default, the TubePress widget will use the following shortcode:
[tubepress resultsPerPage='3', views='false', description='true', descriptionLimit='50', playerLocation='popup', thumbHeight='105', thumbWidth='135']
Of course, like any TubePress shortcode, you can override any setting you like.
http://myblog.comyou'd need to navigate to
http://myblog.com/wp-content/plugins/tubepress/env/WordPress/functions/db_nuke.phpwith your web browser. Once there, you can just click the Reset TubePress Options button. Of course, you'll need to be a WordPress administrator (access level 9) for your blog to do this.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <?php /* STEP 1: Enter the web-accessible URL of your TubePress installation */ $tubepress_base_url = "http://myblog.com/tubepress_pro_1_7_0"; /* STEP 2: Include the TubePress stand-alone library file (tubepress-standalone.php) */ require_once "tubepress_pro_1_7_0/env/standalone/tubepress-standalone.php"; ?> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>TubePress Standalone Example</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <!-- STEP 3: Include this statement inside the HEAD of your HTML document --> <?php print tubepressHeadElements(); ?> </head> <body> <div style="width:500px"> <!-- STEP 4: Call "tubepressGallery" anywhere you like --> <?php print tubepressGallery("resultsPerPage='3'"); ?> </div> </body> </html>Step 1:
print tubepressGallery("resultsPerPage='3'");As the argument to this function, you can include any shortcode you'd like (with or without the square brackets).
<?php require_once "tubepress/env/standalone/tubepress-standalone.php"; get_header(); print tubepressGallery("resultsPerPage='3'"); if (have_posts()) : while (have_posts()) : the_post(); the_content(); endwhile; endif; get_sidebar(); get_footer(); ?>
TubePress shortcodes are small snippets of text that allow you to easily control the content, style, and behavior of TubePress galleries. There are very similar to WordPress shortcodes, with some minor syntax differences.
TubePress will replace any TubePress shortcodes with a video gallery. Each gallery can be configured completely independently from the others, based on the content of the shortcode.
The simplest shortcode is
[tubepress]TubePress will replace this shortcode with a video gallery with the default settings. You can override each TubePress setting by providing shortcode attributes, which are comma-separated name-value pairs that you insert between the square brackets. They all follow the pattern
name='value'Please note the single quotes around the value!
So for instance, say I wanted a gallery with
[tubepress mode='favorites', favoritesValue='3hough', resultsPerPage='10', description='true', playerLocation='lightwindow']
These settings control which group of videos the gallery will display.
Setting | Description | Valid Values | Example |
---|---|---|---|
mode | Which set of videos will be displayed | favorites recently_featured mobile most_discussed most_linked most_recent most_responded playlist most_viewed top_rated tag user |
[tubepress mode='featured'] |
Mode name | Description |
---|---|
favorites |
"Favorite" videos of the given YouTube user. Accompany this mode setting with a favoritesValue attribute to define the YouTube user name. For instance
[tubepress mode='favorites', favoritesValue='3hough']. YouTube limits the number of videos in this type of gallery to 50. |
recently_featured | The lastest "featured" videos on YouTube's homepage |
most_discussed | The most-commented videos on YouTube |
most_linked | Videos with the most links |
most_recent | Videos recently uploaded to YouTube |
most_responded | Videos with the most video responses |
playlist |
Videos from the given playlist. Accompany this mode setting with a playlistValue attribute to define which YouTube playlist to retrieve. For instance
[tubepress mode='playlist', playlistValue='6813408AE8D50E6F']. YouTube limits the number of videos in a playlist to 200. Only public playlists can be shown with TubePress. |
mobile | Videos suitable for mobile devices |
tag |
Show videos matching a search term. Accompany this mode setting with a tagValue attribute to define your search term. For instance
[tubepress mode='tag', tagValue='barack obama john mccain'] |
user |
Videos uploaded by a specific user. Accompany this mode setting with a userValue attribute to define the YouTube user name. For instance
[tubepress mode='user', userValue='3hough'] |
These settings control the overall viewing experience for the user
Setting | Description | Valid Values | Example |
---|---|---|---|
playerLocation | How the user will view each video. See secion 5.2.1 for descriptions of these values. | normal popup youtube |
[tubepress playerLocation='shadowbox'] |
orderBy | The sort order of the video thumbnails | published viewCount rating relevance |
[tubepress orderBy='viewCount'] |
resultsPerPage | How many video thumbnails to display on a single page | Any integer x such that 0 < x <= 50 | [tubepress resultsPerPage='30'] |
thumbHeight | Vertical size (in px) of thumbnails | Any integer x such that 0 < x <= 90 | [tubepress thumbHeight='45'] |
thumbWidth | Horizontal size (in px) of thumbnails | Any integer x such that 0 < x <= 120 | [tubepress thumbWidth='60'] |
Player name | Description |
---|---|
normal | Plays videos in an embedded Flash player above the video thumbnails. If you'd like the page to load with a specific video at the top of the gallery, just add the video's ID to the address of you gallery as the tubepress_video argument. For instance, if my gallery has a URL of http://mygallery.com, I would use http://mygallery.com?tubepress_video=CNo7Hm0IOag to start the gallery with the video with ID CNo7Hm0IOag in the embedded player. You can use any YouTube video ID you like for this argument. |
popup | Plays videos in an HTML popup window |
youtube | Sends user to the video's original YouTube page to view the video |
orderBy value | Description |
---|---|
published | Show videos in the order they were published to YouTube, with the more-recent videos first. |
viewCount | Shows videos in order of how many times they've been viewed, with the more-viewed videos first. |
rating | Shows videos in order of their rating, with the higher-rated videos first. |
relevance | Shows videos in order of relevance. This sort order really only applies to "tag" mode galleries |
These settings apply to the embedded Flash player from YouTube
Setting | Description | Valid Values | Example |
---|---|---|---|
autoPlay | Toggles start of video playback without user intervention | true false |
[tubepress autoPlay='true'] |
border | Toggles frame around embedded player | true false |
[tubepress border='true'] |
embeddedHeight | Vertical size (in px) of embedded player | Any positive integer | [tubepress embeddedHeight='true'] |
embeddedWidth | Horizontal size (in px) of embedded player | Any positive integer | [tubepress embeddedWidth='true'] |
genie | Toggles display of "genie" menu during video playback | true false |
[tubepress genie='true'] |
loop | Toggles repeat of videos without user intervention | true false |
[tubepress loop='true'] |
playerColor | Primary and secondary colors of embedded player | Two HTML color values in hex, combined with a single forward slash | [tubepress playerColor='0xffaabb/0xaa2233'] |
quality | Quality of video and audio | normal high higher highest |
[tubepress quality='higher'] |
showRelated | Toggles display of related videos after playback | true false |
[tubepress showRelated='true'] |
These settings control what information gets printed out below each video thumbnail
Setting | Description | Valid Values | Example |
---|---|---|---|
author | Toggles display of video author below thumbnails | true false |
[tubepress author='true'] |
category | Toggles display of video category below thumbnails | true false |
[tubepress category='false'] |
description | Toggles display of video description below thumbnails | true false |
[tubepress description='false'] |
id | Toggles display of video ID below thumbnails | true false |
[tubepress id='true'] |
length | Toggles display of video run time below thumbnails | true false |
[tubepress length='false'] |
rating | Toggles display of average video rating below thumbnails | true false |
[tubepress rating='true'] |
ratings | Toggles display of video rating count below thumbnails | true false |
[tubepress ratings='true'] |
tags | Toggles display of video tags below thumbnails | true false |
[tubepress tags='false'] |
title | Toggles display of video title below thumbnails | true false |
[tubepress title='true'] |
uploaded | Toggles display of video upload time below thumbnails | true false |
[tubepress uploaded='false'] |
url | Toggles display of video URL on YouTube? below thumbnails | true false |
[tubepress url='false'] |
views | Toggles display of video view count below thumbnails | true false |
[tubepress views='true'] |
Various features that casual users will not likely need/want to adjust
Setting | Description | Valid Values | Example |
---|---|---|---|
dateFormat | Formatting of date information for videos. See http://us.php.net/date for examples | Any valid string as defined by http://php.net/date | [tubepress dateFormat='l jS \of F Y h:i:s A'] |
debugging_enabled | Toggles ability to perform remote debugging | true false |
[tubepress debugging_enabled='false'] |
randomize_thumbnails | Toggles random thumbnail selection for each video (each video comes with several thumbnails) | true false |
[tubepress randomize_thumbnails='false'] |
filter_racy | Toggles filtering of "racy" videos | true false |
[tubepress filter_racy='true'] |
This mode will print out tons of debugging information. To use it, you just need to add tubepress_debug=true to the URL string (in your browser's address bar). For instance, if the TubePress page you're trying to debug has an address of
http://ehough.com/?page_id=19then you should add tubepress_debug=true to the URL to enable debugging
http://ehough.com/?page_id=19&tubepress_debug=trueYou should see the debugging information displayed above any galleries you have. The following image shows generally what you can expect to see
Still can't solve your issue? Try searching or posting in the TubePress discussion forum, hosted by Google Groups. You'll need a Google account to post.
If you can't find a solution to your problem in the discussion forum, someone may have already submitted a trouble ticket. The current list of tickets can be found at http://code.google.com/p/tubepress/issues/list. Please feel free to submit a trouble ticket. Note that you'll need a Google account.
As of version 1.6.5, TubePress can be translated into any language using the gettext framework. To submit a translation...
You will, of course, receive full credit for your contribution to an open source project! If you're interested in the gory details of how it works, I highly recommend reading WordPress's excellent i18n documentation.
TubePress is an open source project. I've spent many long nights working on this project. If you enjoy the software, please consider a donation. No amount is too small. Thanks!