Use Config object to store config options
This commit is contained in:
@@ -34,7 +34,11 @@ add_filter('excerpt_more', function () {
|
||||
array_map(function ($type) {
|
||||
add_filter("{$type}_template_hierarchy", function ($templates) {
|
||||
return call_user_func_array('array_merge', array_map(function ($template) {
|
||||
$normalizedTemplate = preg_replace(['%^/?(templates)?/?%', '%(\.blade)?(\.php)?$%'], '', $template);
|
||||
$transforms = [
|
||||
'%^/?(templates)?/?%' => config('sage.disable_option_hack') ? 'templates/' : '',
|
||||
'%(\.blade)?(\.php)?$%' => ''
|
||||
];
|
||||
$normalizedTemplate = preg_replace(array_keys($transforms), array_values($transforms), $template);
|
||||
return ["{$normalizedTemplate}.blade.php", "{$normalizedTemplate}.php"];
|
||||
}, $templates));
|
||||
});
|
||||
@@ -53,7 +57,7 @@ add_filter('template_include', function ($template) {
|
||||
echo template($template, $data);
|
||||
|
||||
// Return a blank file to make WordPress happy
|
||||
return get_template_directory() . '/index.php';
|
||||
return dirname(__DIR__).'/index.php';
|
||||
}, PHP_INT_MAX);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user