Templates
in package
Allows rendering of specific templates with Twig.
Table of Contents
- $template_context : Template_Context
- The template context generator.
- __wakeup() : mixed
- Wakeup.
- add_twig_to_template_hierarchy() : array<string|int, mixed>
- echo_twig() : void
- Echo template.
- get_instance() : Templates
- Get instance.
- get_stylesheet_dir() : string
- Gets the stylesheet directory Clarkson Core is using to find twig templates.
- get_template_dir() : string
- Retrieves the parent theme directory Clarkson Core is using to find templates.
- get_templates_dirs() : array<string|int, mixed>
- Get the template directories where the Twig files are located in.
- render_twig() : string
- Render template using Twig.
Properties
$template_context
The template context generator.
public
Template_Context
$template_context
This object can be used if you want to remove any of the default add_filters.
Methods
__wakeup()
Wakeup.
public
__wakeup() : mixed
Return values
mixed —add_twig_to_template_hierarchy()
public
add_twig_to_template_hierarchy(array<string|int, mixed> $original_templates) : array<string|int, mixed>
Parameters
- $original_templates : array<string|int, mixed>
Return values
array<string|int, mixed> —echo_twig()
Echo template.
public
echo_twig(string $template_file, array<string|int, mixed> $objects[, bool $ignore_warning = false ]) : void
see: https://github.com/level-level/Clarkson-Core/issues/126.
Parameters
- $template_file : string
-
Post meta _wp_page_template.
- $objects : array<string|int, mixed>
-
Post objects.
- $ignore_warning : bool = false
-
Ignore multiple render warning.
Return values
void —get_instance()
Get instance.
public
static get_instance() : Templates
Return values
Templates —get_stylesheet_dir()
Gets the stylesheet directory Clarkson Core is using to find twig templates.
public
get_stylesheet_dir() : string
Return values
string —get_template_dir()
Retrieves the parent theme directory Clarkson Core is using to find templates.
public
get_template_dir() : string
Return values
string —get_templates_dirs()
Get the template directories where the Twig files are located in.
public
get_templates_dirs() : array<string|int, mixed>
This takes notices of the child / parent hierarchy, so that's why the child theme gets searched first and then the parent theme, just like the regular WordPress templating hierarchy.
Return values
array<string|int, mixed> —render_twig()
Render template using Twig.
public
render_twig(string $path, array<string|int, mixed> $objects[, bool $ignore_warning = false ]) : string
Parameters
- $path : string
-
Post meta _wp_page_template.
- $objects : array<string|int, mixed>
-
Post objects.
- $ignore_warning : bool = false
-
Ignore multiple render warning.