TubePress shortcodes are small snippets of text that allow you to easily and completely control the content, style, and behavior of TubePress galleries. They are invoked slightly differently in the WordPress plugin and in TubePress Pro, but the actual shortcodes themselves are identical.
In TubePress terminology, a shortcode is a collection of name-value pairs (a.k.a. "attributes") that follow the pattern optionName=optionValue, where optionValue
is wrapped with single or double quotes (e.g. foo="bar"). Each valid shortcode attribute is defined in Section 7.3, “TubePress Shortcode Reference”.
TubePress shortcodes are very similar to WordPress shortcodes, but with minor syntax differences. TubePress will replace any TubePress shortcode it finds in a post or page 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]
In a post or a page, TubePress will replace this shortcode with a video gallery defined by the default settings. You can override each TubePress setting by providing any of the shortcode attributes found in Section 7.3, “TubePress Shortcode Reference”.
In TubePress Pro, you can provide shortcode attributes found in Section 7.3, “TubePress Shortcode Reference” to the tubepressGallery function
to completely control the behavior of your galleries. e.g.
print tubepressGallery("ajaxPagination='true' author='false'");Each gallery can be configured completely independently from the others, based on the content of the shortcode.
These shortcodes determine which videos will populate the gallery
Table 7.1. Gallery Content Shortcodes
| Mode Name | Description | Notes | Example |
|---|---|---|---|
favorites and favoritesValue | "Favorite" videos of a YouTube user. The YouTube user is defined by the
value you supply to the favoritesValue attribute. | Limited to 50 videos | [tubepress mode="favorites" favoritesValue="3hough"] |
recently_featured | The lastest "featured" videos on YouTube's homepage | [tubepress mode="recently_featured"] | |
most_discussed | The most-commented videos on YouTube | [tubepress mode="most_discussed"] | |
most_linked | YouTube videos with the most links | [tubepress mode="most_linked"] | |
most_recent | YouTube videos most recently uploaded to YouTube | [tubepress mode="most_recent"] | |
most_responded | YouTube videos with the most video responses | [tubepress mode="most_responded"] | |
playlist and playlistValue | Videos from a YouTube playlist. The playlist is defined by the value you supply to the
playlistValue attribute.
|
|
[tubepress mode="playlist" playlistValue="6813408AE8D50E6F"]
|
mobile | YouTube videos suitable for mobile devices | [tubepress mode="mobile"] | |
tag and tagValue | YouTube videos matching a search term. The search term is defined by
the value you supply to the tagValue attribute.
| Limited to approximately 1000 videos | [tubepress mode="tag" tagValue="barack obama john mccain"] |
user and userValue | YouTube videos uploaded by a specific YouTube user.
The YouTube user is defined by the value you supply to the userValue attribute.
| Limited to approximately 1000 videos | [tubepress mode="user" userValue="3hough"] |
Table 7.2. Single video shortcodes
| Setting | Description | Notes | Example |
|---|---|---|---|
video | The ID of the video to embed | [tubepress video="J51kfduN5aA"] |
These settings control the overall appearance of the gallery
Table 7.3. Display Options
| Setting | Description | Valid Value(s) | Example |
|---|---|---|---|
ajaxPagination | TubePress Pro only. Use AJAX to paginate galleries asynchronously. |
| [tubepress ajaxPagination="true"] |
descriptionLimit | Limit the length of video descriptions to a certain number of characters. This can help prevent video descriptions from overflowing onto other thumbnails. | Any positive integer | [tubepress descriptionLimit="50"] |
paginationAbove | If resultsPerPage is less than the total number of videos in the gallery, setting this value to true
will display pagination links above the gallery thumbnails
|
| [tubepress paginationAbove="true"] |
paginationBelow | If resultsPerPage is less than the total number of videos in the gallery, setting this value to true
will display pagination links below the gallery thumbnails
|
| [tubepress paginationBelow="true"] |
relativeDates | Display yesterday instead of November 3, 2009, for instance.
|
| [tubepress relativeDates="true"] |
resultsPerPage | How many video thumbnails to display on a single page | Any integer x such that 0 < x <= 50 | [tubepress resultsPerPage="30"] |
template | Custom template | Name of a readable file located in ui/gallery/html_templates (for galleries) or
ui/single_video/html_templates (for single videos). These are the only permissible
locations for custom templates. | [tubepress template="custom_template.tpl.html"] |
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"] |
In TubePress terminology, a "player location" defines where the embedded video player will appear after
the user clicks a thumbnail to play a video. TubePress offers several different options, each of which can
be activated by supplying the desired value to the playerLocation shortcode attribute.
Table 7.4. Player Locations
playerLocation Value | Description | Example |
|---|---|---|
fancybox | TubePress Pro only. Plays videos using FancyBox | [tubepress playerLocation="fancybox"] |
jqmodal | Plays videos using jqModal | [tubepress playerLocation="jqModal"] |
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 For instance, given a gallery with a URL of | [tubepress playerLocation="normal"] |
popup | Plays videos in an HTML popup window | [tubepress playerLocation="popup"] |
shadowbox | Plays videos using ShadowBox | [tubepress playerLocation="shadowbox"] |
static | Behaves exactly the same as the normal player, but each thumbnail click will
trigger a page refresh. This can be useful if you want to increase page loads for advertising purposes. It
also makes it clearer to your users on how they can share links to individual videos. | [tubepress playerLocation="static"] |
tinybox | TubePress Pro only. Plays videos using TinyBox | [tubepress playerLocation="tinybox"] |
youtube | Redirects to the video's original YouTube page | [tubepress playerLocation="youtube"] |
The sorting capabilities of TubePress are limited by the providers of the videos (e.g. YouTube). Sorting functionality
can be quirky, and there are some limitations. Below are the shortcodes, all based on the orderBy attribute,
that control the video sort order.
Table 7.5. Video Sort Order
orderBy Value | Description | Notes | Example |
|---|---|---|---|
published | Show videos in the order they were published | YouTube galleries will show more-recent videos first | [tubepress orderBy="published"] |
viewCount | Shows videos in order of how many times they've been viewed | YouTube galleries will show more-viewed videos first | [tubepress orderBy="viewCount"] |
rating | Shows videos in order of their rating | YouTube galleries will show higher-rated videos first | [tubepress orderBy="rating"] |
relevance | Shows videos in order of relevance | Only applies to YouTube tag galleries | [tubepress orderBy="relevance"] |
random | Shuffles videos for a given gallery page | Will only randomize the order for a single gallery page. e.g. If you have a gallery with a total of 500 videos, with 20 videos per page, only 20 videos at a time will be shuffled. This is a restriction on YouTube's end. | [tubepress orderBy="random"] |
Please note that these galleries can't be sorted
A gallery of a user's favorite videos (mode="favorites") will always be sorted in the
order that the videos were favorited.
A playlist gallery (mode="playlist") will always be sorted in the order that the videos
appear in the playlist
These shortcodes control the appearance and behavior the embedded Flash player.
Table 7.6. Embedded Player Shortcodes
| Setting | Description | Valid Values | Example |
|---|---|---|---|
autoplay | Start video playback without user intervention |
| [tubepress autoplay="true"] |
border | Frame embedded player |
| [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"] |
fullscreen | Allow fullscreen playback |
| [tubepress fullscreen="true"] |
genie | Display "genie" menu during video playback |
| [tubepress genie="true"] |
hd | Display high definition videos |
| [tubepress hd="true"] |
loop | Repeat videos without user intervention |
| [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"] |
playerImplementation | Choose vendor of embedded Flash player. Current choices are the standard YouTube player, or the JW FLV Media Player from LongTail. |
| [tubepress playerImplementation="longtail"] |
showInfo | Display title and rating before playback |
| [tubepress showInfo="true"] |
showRelated | Display related videos after playback |
| [tubepress showRelated="true"] |
These shortcodes control what information is displayed below each video thumbnail.
Table 7.7. Video Meta Display
| Setting | Description | Valid Values | Example |
|---|---|---|---|
author | Display video author |
| [tubepress author="true"] |
category | Display video category |
| [tubepress category="false"] |
description | Display video description |
| [tubepress description="false"] |
id | Display video ID |
| [tubepress id="true"] |
length | Display video run time |
| [tubepress length="false"] |
rating | Display average video rating |
| [tubepress rating="true"] |
ratings | Display video rating count |
| [tubepress ratings="true"] |
tags | Display video keywords |
| [tubepress tags="false"] |
title | Display video title |
| [tubepress title="true"] |
uploaded | Display video upload timestamp |
| [tubepress uploaded="false"] |
url | Display video URL on YouTube |
| [tubepress url="false"] |
views | Display video view count |
| [tubepress views="true"] |
These shortcodes control how TubePress interacts with content providers (e.g. YouTube)
Table 7.8. Video Feed Shortcodes
| Setting | Description | Valid Values | Example |
|---|---|---|---|
cacheEnabled | Use a file-based cache to store responses from provider |
| [tubepress cacheEnabled="false"] |
clientKey | The YouTube Client Key when interacting with YouTube | Any valid YouTube Client Key | [tubepress clientKey="33AEF33BBC344"] |
developerKey | The YouTube Developer Key when interacting with YouTube | Any valid YouTube Developer Key | [tubepress developerKey="33AEF33BBC344"] |
embeddableOnly | Only retrieve videos that can be embedded in other sites |
| [tubepress embeddableOnly="true"] |
filter_racy | Retrieve videos that may be unsuitable for minors |
| [tubepress filter_racy="true"] |
resultCountCap | Maximum total videos to retrieve | Any integer x such that x >= 0 | This can help to reduce the number of pages in your gallery. Set to "0" to remove any limit. |
Various features that casual users will not likely need or want to adjust
Table 7.9. Advanced Shortcodes
| 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 | Enable ability to perform remote debugging |
| [tubepress debugging_enabled="false"] |
randomize_thumbnails | Randomize thumbnail selection for each video (each video comes with several thumbnails) |
| [tubepress randomize_thumbnails="false"] |