Remove templates/ when normalizing templates in hierarchy filters

This commit is contained in:
QWp6t
2016-12-24 04:42:05 -08:00
parent 50a6f8ea60
commit 5d454ba8ed

View File

@@ -34,7 +34,7 @@ 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('%(\.blade)?(\.php)?$%', '', $template);
$normalizedTemplate = preg_replace(['%^/?(templates)?/?%', '%(\.blade)?(\.php)?$%'], '', $template);
return ["{$normalizedTemplate}.blade.php", "{$normalizedTemplate}.php"];
}, $templates));
});