4. TubePress Video Galleries

4.1 WordPress Posts and Pages (Free and Pro versions)

As a WordPress plugin, TubePress lets you easily insert custom video galleries throughout your WordPress-powered blog. Just configure from Settings > TubePress, then type

[tubepress]

in a post or page where you'd like your gallery to appear.

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. This is done with TubePress shortcodes.

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!

4.2 WordPress Templates (Pro only)

You can also use TubePress Pro to insert video galleries outside the WordPress Loop (i.e. in your WordPress templates). The code snippet below shows the world's simplest index page with TubePress Pro added. As you can see, there are only 2 steps.

<?php

    require_once "/var/www/html/myblog.com/wp-content/plugins/tubepress_pro_1_8_9/env/pro/tubepress-pro.php";     (1)

    get_header();

    print tubepressGallery('mode="tag" tagValue="barack obama" resultsPerPage="3"');                              (2)
    
    if (have_posts()) :
       while (have_posts()) :
          the_post();
          the_content();
       endwhile;
    endif;
    get_sidebar();
    get_footer(); 
?>
             

1

Include the TubePress Pro library file (tubepress-pro.php). An absolute path works best.

2

This statement prints out the TubePress gallery contents. It takes a single string parameter which is any valid TubePress shortcode, with or without the enclosing [tubepress wrapper. You repeat this function call as many times as you like.

4.3 Standalone PHP (Pro version only)

The following is a very simple PHP file that generates a gallery with TubePress Pro. As you can see, there are only four steps involved.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?php 

    $tubepress_base_url = "http://myblog.com/lib/tubepress_pro_1_8_9";                                  (1)

    require_once "/var/www/html/myblog.com/lib/tubepress_pro_1_8_9/env/pro/tubepress-pro.php";          (2)
?>

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
        <title>TubePress Pro</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

        <?php print tubepressHeadElements(true); ?>                                                     (3)
    </head>
    <body>
        <div style="width:500px">

            <?php print tubepressGallery('mode="tag" tagValue="barack obama" resultsPerPage="3"'); ?>   (4)

        </div>
    </body>
</html>
                

1

Set tubepress_base_url to the web-accessible URL of your TubePress Pro installation.

2

Include the TubePress Pro library file (tubepress-pro.php). An absolute path works best.

3

Include this statement in the 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

This statement prints out the TubePress gallery contents. It takes a single string parameter which is any valid TubePress shortcode, with or without the enclosing [tubepress wrapper. You repeat this function call as many times as you like to insert multiple galleries on a single page.

4.4 Sidebar/Widget Galleries

All versions of TubePress come with the ability to integrate a vertical gallery of videos in the sidebar of your site. You can fully customize the content and appearance of this sidebar as you would a regular TubePress gallery. Here's a sample of what the sidebar gallery can look like...

4.4.1 WordPress (Free and Pro versions)

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 at WP Admin > Appearance > Widgets...

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" template="sidebar.tpl.php"]

Of course, like any TubePress shortcode, you can override any setting you like.

4.4.2 Standalone PHP (Pro version only)

Creating a sidebar gallery with TubePress Pro in standalone PHP is nearly identical to the procedure for creating video galleries in standalone PHP. The only difference is that you use the template shortcode attribute to tell your gallery to use the sidebar HTML template (sidebar.tpl.php). So your gallery generation statement would look like this...

<?php print tubepressGallery('mode="tag" tagValue="barack obama" resultsPerPage="3" template="sidebar.tpl.php"'); ?>