I'm stuck getting the Cortex router to work with the Sage9 WordPress theme.
The template inheritance seems to be broken because of the template_include
filter. Cortex removes all template_include
filters which does not allow Sage to use it's template wrapper.
Cortex Template Include
add_filter('template_include', function () use ($template) {
remove_all_filters('template_include');
return $template;
}, -1);
Sage 9 Template Include
https://github.com/roots/sage/blob/sage-9/src/filters.php#L48-L53
add_filter('template_include', function ($main) {
if (!is_string($main) && !(is_object($main) && method_exists($main, '__toString'))) {
return $main;
}
return ((new Template(new Wrapper($main)))->layout());
}, 109);