Wrap templates located outside the theme

Wrapper will now pass through $template if locate_template() turns up zero
results.
This commit is contained in:
QWp6t
2016-07-14 15:00:07 -07:00
parent ca4db00fab
commit 4435d52d01
2 changed files with 2 additions and 2 deletions

View File

@@ -49,5 +49,5 @@ add_filter('template_include', function ($main) {
if (!is_string($main) || !(string) $main) { if (!is_string($main) || !(string) $main) {
return $main; return $main;
} }
return template_wrap(new Wrapper(basename($main))); return template_wrap(new Wrapper($main));
}, 109); }, 109);

View File

@@ -60,6 +60,6 @@ class Wrapper implements WrapperInterface
public function getTemplate() public function getTemplate()
{ {
$template = apply_filters('sage/unwrap_' . $this->slug, $this->template) ?: $this->template; $template = apply_filters('sage/unwrap_' . $this->slug, $this->template) ?: $this->template;
return locate_template($template); return locate_template($template) ?: $template;
} }
} }