|
|
|
@@ -12,6 +12,7 @@ use WP_Error;
|
|
|
|
|
class TemplateLoader {
|
|
|
|
|
|
|
|
|
|
static array $templates_parts;
|
|
|
|
|
private static $template_loaded = false;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Initializes the template rendering process.
|
|
|
|
@@ -23,6 +24,7 @@ class TemplateLoader {
|
|
|
|
|
foreach ($templates_path as $path) {
|
|
|
|
|
if (file_exists($path)) {
|
|
|
|
|
load_template($path);
|
|
|
|
|
self::$template_loaded = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -40,6 +42,7 @@ class TemplateLoader {
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public static function getTemplates($template, $type, $templates) {
|
|
|
|
|
if (self::$template_loaded) return;
|
|
|
|
|
if ($type === "home" || $type === "frontpage") $type = "page";
|
|
|
|
|
$key = (int)$type !== 0 ? "errors" : preg_replace("/y$/m", "ie", $type)."s";
|
|
|
|
|
|
|
|
|
@@ -129,6 +132,20 @@ class TemplateLoader {
|
|
|
|
|
self::getDefault($template_path, $type, $templates);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Processes and updates the singular templates by delegating to the default handler.
|
|
|
|
|
*
|
|
|
|
|
* @param string $template_path The base path to the templates used for singular views.
|
|
|
|
|
* @param string $type The specific type of singular content being processed.
|
|
|
|
|
* @param array $templates An array of template file names for singular content.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public static function getSingulars($template_path, $type, $templates): void {
|
|
|
|
|
self::getDefault($template_path, $type, $templates);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Generates an array of single templates with processed paths and stores them in the template parts.
|
|
|
|
|
*
|
|
|
|
|