Add shared $post variable to Blade
This commit is contained in:
@@ -89,6 +89,14 @@ add_action('widgets_init', function () {
|
|||||||
] + $config);
|
] + $config);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the `$post` variable on each iteration of the loop.
|
||||||
|
* Note: updated value is only available for subsequently loaded views, such as partials
|
||||||
|
*/
|
||||||
|
add_action('the_post', function ($post) {
|
||||||
|
sage('blade')->share('post', $post);
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup Sage options
|
* Setup Sage options
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user