我很难让Cortex路由器与Sage9 WordPress主题配合使用。
由于template_include
过滤器,模板继承似乎已被破坏。 Cortex删除了所有不允许Sage使用它的模板包装的template_include
过滤器。
包含Cortex模板
add_filter('template_include', function () use ($template) {
remove_all_filters('template_include');
return $template;
}, -1);
Sage 9模板包含
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);