Hi guys,
I’ve been working for a little while on the new sage9 version of the theme.
I noticed that the current wrapper logic disregards any template coming from external plugins and expects to find any template file within the current theme.
While this is generally ok when developing a theme, it gives some headache when a plugin is injecting a custom preview page template.
I simply changed the filter:
add_filter('template_include', function ($main) {
if (!is_string($main) || !(string) $main || strpos($main, "plugins") !== false) {
return $main;
}
return template_wrap(new Wrapper(basename($main)));
}, 109);
To exclude templates coming from the plugins folder.
Thought this might be useful for somebody else as well and might be worth taking into consideration for the core wrapper logic.
Cheers,
Nick