During its execution, TubePress relies on a set of Twig templates to produce its final HTML. A TubePress theme may contain templates that TubePress will use instead of its defaults, thereby giving you full control of the HTML structure TubePress's output.
If you only want to change the style of TubePress's output, you probably don't need to bother with editing templates. Instead, try to utilize CSS in a theme. Templates control the structure of the final HTML, which doesn't need to change as often.
TubePress uses a handful of templates, each identified uniquely by a logical name. The following table lists the logical name of each template, along with a description of where it's used.
|Logical Template Name||Used for ...|
CSS tags and inline CSS that TubePress produces.
This will end up in the HTML
||Returning an error message after a TubePress Ajax operation fails.|
||Displaying an error message to the user when TubePress hits an unrecoverable error.|
Returning HTML to be displayed to the user after a thumbnail is clicked. Replace
Returning HTML, to be displayed along with the initial load of thumbnails, that contains the
embedded video. Replace
||Arguably the most important template. Controls overall layout of video galleries and thumbnails.|
||Clickable page numbers for galleries that span multiple pages.|
||Interactive search input text field and button.|
||Ajax-enabled interactive search input text field and button.|
||Single video embeds.|
Each logical template name must be converted to an actual template file on your web server. TubePress uses the following search procedure to accomplish this task.
First TubePress looks for a directory named
templates at the root directory of the active
theme. If this directory exists, TubePress looks inside for a template with the relative (from
templates directory) filesystem path of
If a file at that path is found, TubePress will use this given template and the search ends here.
For instance, given the logical template name
gallery/pagination, TubePress would look
inside the active theme directory for a file at
If the active theme has a parent theme,
Step 1 is repeated with the parent theme. This is a recursive process, so TubePress will search up the
entire theme hierarchy until there are
no more theme parents to check. If the template is still not found, TubePress goes on to Step 3.
If the previous steps fail to locate a template file on the filesystem, TubePress will revert to a default,
internal template to produce the HTML.
If you'd like to make changes to a template, we strongly recommend that you first read Twig's excellent template documentation. This will guide you through the entire process of editing a template.
Twig templates are compiled and cached on the filesystem for maximum performance. If you add, remove, or edit a template file, you will need to clear the TubePress system cache before you see the changes live on your site.