Add TubePress to WordPress Templates

This page describes how to use TubePress in WordPress templates. You might also be interested in adding TubePress to posts and pages.
Note

A basic understanding of PHP is very helpful when using this feature.

It's very easy to use TubePress in any WordPress template. Below we have the world's simplest WordPress template with TubePress added:

<?php

  include WP_PLUGIN_DIR . '/tubepress_pro_x_y_z/src/TubePressPro.php';

  get_header();

  print TubePressPro::getHTML('mode="tag" tagValue="pittsburgh steelers"');

  if (have_posts()) :
      while (have_posts()) :
          the_post();
          the_content();
      endwhile;
  endif;
  get_sidebar();
  get_footer();
?>

There are two important lines in the above code. Let's study them in detail:

  1. include WP_PLUGIN_DIR . '/tubepress_pro_x_y_z/src/TubePressPro.php';

    Include the TubePress Pro library file TubePressPro.php anywhere before the template's call to get_header(). Note that you will need to replace tubepress_pro_x_y_z with the actual version of TubePress that you downloaded (.e.g. tubepress_pro_4_4_8).


     
  2. print TubePressPro::getHTML('mode="tag" tagValue="pittsburgh steelers"');

    The TubePressPro::getHTML() static function takes a single string parameter which is any space-separated combination of TubePress options. It returns the HTML output of TubePress as a string. You may repeat this function call as many times as you like, along with any combination of options.



Last Updated Feb 20, 2016 05:55PM PST
c65861bf7a72e1a8878bdf73cabbbdbf@tubepress.desk-mail.com
http://assets3.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete