Wrap templates located outside the theme
Wrapper will now pass through $template if locate_template() turns up zero results.
This commit is contained in:
@@ -49,5 +49,5 @@ add_filter('template_include', function ($main) {
|
||||
if (!is_string($main) || !(string) $main) {
|
||||
return $main;
|
||||
}
|
||||
return template_wrap(new Wrapper(basename($main)));
|
||||
return template_wrap(new Wrapper($main));
|
||||
}, 109);
|
||||
|
||||
@@ -60,6 +60,6 @@ class Wrapper implements WrapperInterface
|
||||
public function getTemplate()
|
||||
{
|
||||
$template = apply_filters('sage/unwrap_' . $this->slug, $this->template) ?: $this->template;
|
||||
return locate_template($template);
|
||||
return locate_template($template) ?: $template;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user