Add data from controller to comments template

This commit is contained in:
Daniel Mejta
2018-08-28 07:19:59 +02:00
parent 8a023b4307
commit fa1681dad9

View File

@@ -72,10 +72,14 @@ add_filter('comments_template', function ($comments_template) {
$comments_template
);
$data = collect(get_body_class())->reduce(function ($data, $class) use ($template) {
return apply_filters("sage/template/{$class}/data", $data, $template);
}, []);
$theme_template = locate_template(["views/{$comments_template}", $comments_template]);
if ($theme_template) {
echo template($theme_template);
echo template($theme_template, $data);
return get_stylesheet_directory().'/index.php';
}