0

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

https://github.com/Brain-WP/Cortex/blob/refactoring-fastroute/src/Cortex/Router/ResultHandler.php#L139-L143

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);
4

1 回答 1

0

感谢 Giuseppe Mazzapica

https://github.com/Brain-WP/Cortex/issues/15

于 2016-08-03T16:01:44.980 回答