apply_filters( 'clarkson_core_template_context', $context, $wp_query ) → {array}
Add and modify variables available during the template rendering.
Parameters:
Name | Type | Description |
---|---|---|
$context |
array | The context that will be passed onto the template. |
$wp_query |
WP_Query | The current query that is being rendered. |
- Since:
- 1.0.0
- Source:
Returns:
The context that will be passed onto the template.
- Type
- array
Example
// It is possible to add custom variables to the twig context.
add_filter( 'clarkson_core_template_context', function( $context, $wp_query ) {
if( $wp_query->is_tax ){
$context['tax_variable'] = true;
}
return $context
} );