apply_filters( 'clarkson_template_class', $type, $post ) → {null|string}
Allows the theme to overwrite class that is going to be used to create a template object.
Parameters:
Name | Type | Description |
---|---|---|
$type |
null | string | Sanitized class name. |
$post |
WP_Post | The WordPress post to load a template for. |
- Since:
- 1.0.0
- Source:
Returns:
Class name of template to be created.
- Type
- null | string
Example
// load a different class instead of what Clarkson Core calculates.
add_filter( 'clarkson_template_class', function( $class, $post ) {
if ( $post->ID === 15 ){
$class = self::OBJECT_CLASS_NAMESPACE . 'custom_template_class';
}
return $class;
}, 10, 2 );