Templates implements Template_Loader
A WooCommerce template loader.
Tags
Interfaces, Classes and Traits
- Template_Loader
- An object which can load PHP templates.
Table of Contents
- $default_path : mixed
- $template_path : mixed
- $templates_loaded_once : mixed
- __construct() : mixed
- get_default_path() : mixed
- get_template() : string
- Return the HTML for the specified template.
- get_template_path() : mixed
- load_template() : mixed
- Output the HTML for the specified template.
- load_template_once() : mixed
- Output the HTML for the specified template, but only once. If this function is called multiple times with the same template name, the template is only rendered once on the page.
- expand_template() : mixed
Properties
$default_path
private
mixed
$default_path
$template_path
private
mixed
$template_path
$templates_loaded_once
private
mixed
$templates_loaded_once
= []
Methods
__construct()
public
__construct([mixed $theme_dir = '' ][, mixed $default_path = '' ]) : mixed
Parameters
- $theme_dir : mixed = ''
- $default_path : mixed = ''
Return values
mixed —get_default_path()
public
get_default_path() : mixed
Return values
mixed —get_template()
Return the HTML for the specified template.
public
get_template(string $template_name[, array<string|int, mixed> $args = [] ]) : string
Parameters
- $template_name : string
-
The template name (e.g. 'path/to/template.php')
- $args : array<string|int, mixed> = []
-
The template args.
Return values
string —The template HTML.
get_template_path()
public
get_template_path() : mixed
Return values
mixed —load_template()
Output the HTML for the specified template.
public
load_template(string $template_name[, array<string|int, mixed> $args = [] ]) : mixed
Parameters
- $template_name : string
-
The template name (e.g. 'path/to/template.php')
- $args : array<string|int, mixed> = []
-
The template args.
Return values
mixed —load_template_once()
Output the HTML for the specified template, but only once. If this function is called multiple times with the same template name, the template is only rendered once on the page.
public
load_template_once(string $template_name[, array<string|int, mixed> $args = [] ]) : mixed
Parameters
- $template_name : string
-
The template name (e.g. 'path/to/template.php')
- $args : array<string|int, mixed> = []
-
The template args.
Return values
mixed —expand_template()
private
expand_template(mixed $template_name) : mixed
Parameters
- $template_name : mixed