Add data from controller to comments template
This commit is contained in:
@@ -72,10 +72,14 @@ add_filter('comments_template', function ($comments_template) {
|
|||||||
$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]);
|
$theme_template = locate_template(["views/{$comments_template}", $comments_template]);
|
||||||
|
|
||||||
if ($theme_template) {
|
if ($theme_template) {
|
||||||
echo template($theme_template);
|
echo template($theme_template, $data);
|
||||||
return get_stylesheet_directory().'/index.php';
|
return get_stylesheet_directory().'/index.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user