Basic Invocation of TubePress

Invoking TubePress on your site is really easy! It's done slightly differently depending on where you'll be using TubePress, so follow the instructions below that match your environment. In all cases, however, you'll be using a TubePress shortcode.

TubePress shortcodes are small snippets of text that give you complete control over what TubePress will output to your users. You should definitely check out the TubePress Shortcode Reference.

WordPress Posts and Pages

Follow these instructions to use TubePress (free version or Pro version) in WordPress posts and/or pages. Make sure TubePress is enabled from WP Admin > Plugins, then just type in a WordPress post and/or page. When a user visits this post/page, TubePress will replace your shortcode with some HTML content (a single video or a gallery). You may notice that TubePress shortcodes are very similar to WordPress shortcodes, but with some slight syntactical differences.

The options in Settings > TubePress are the global options for TubePress; i.e. if you type [tubepress] and nothing else, these options will be used. The real power of the plugin lies in the ability to be invoked in unique ways on multiple posts and pages. This is done with, like everything else in TubePress, with shortcodes. For example, say on one page you want to display a gallery of YouTube videos that are tagged with "football", want 15 videos per page, and want to play the videos in an HTML poupup window. On this page, you would type

on the page where you want the gallery to show up. And say on another page you want to display a different gallery with the default (global) options that were set in Settings > TubePress. On this page you would type

where you wanted the gallery to show up. Follow this procedure for unlimited galleries on unlimited posts/pages. Just use any TubePress shortcode to control the gallery content.

WordPress Templates

Follow these instructions to use TubePress (Pro version only) outside of the WordPress Loop (i.e. in your WordPress templates). The code snippet below shows the world's simplest WordPress template with TubePress Pro added. As you can see by the highlighted lines below, there are only 2 steps:

  1. Include the TubePress Pro library file (tubepress-pro.php). An absolute path works best.
  2. The getHtmlForShortcode static function takes a single string parameter which is any valid TubePress shortcode. It returns the HTML output of TubePress. You may repeat this function call as many times as you like.

Standalone PHP

Follow these instructions to use TubePress (Pro version only) in any PHP5 environment. As you can see by the highlighted lines of the PHP file below, there are only four steps:

  1. Set tubepress_base_url to the web-accessible URL of your TubePress Pro installation.
  2. Include the TubePress Pro class definition (TubePressPro.class.php). An absolute path works best.
  3. Include this statement in the HTML head of your document to print out the required TubePress CSS and JavaScript libraries. It takes a single parameter which indicates whether or not to include jQuery. If you are already including jQuery in your document, use false for this parameter.
  4. The getHtmlForShortcode function takes a single string parameter which is any valid TubePress shortcode It returns the HTML output of TubePress. You may repeat this function call as many times as you like.
usage/basic-invocation.txt · Last modified: 2011/03/21 00:21 by Eric Hough
GNU Free Documentation License 1.3