🐛 - Fix loading template issue who display errors on Wordpress Website
This commit is contained in:
parent
1dd6c3236d
commit
a4c6a63692
@ -17,7 +17,8 @@
|
||||
"larapack/dd": "^1.1"
|
||||
},
|
||||
"suggest": {
|
||||
"larapack/dd": "Required to use the dd method."
|
||||
"larapack/dd": "Required to use the dd method.",
|
||||
"roots/wordpress": "This package need Wordpress environment to be used."
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@ -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.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user