apply_filters( 'clarkson_object_type', $type, $post ) → {null|string}
Allows the theme to overwrite class that is going to be used to create an object.
Parameters:
Name | Type | Description |
---|---|---|
$type |
null | string | Sanitized class name. |
$post |
WP_Post | Sanitized class name. |
- Since:
- 0.1.1
- Source:
Returns:
Class name of object to be created.
- Type
- null | string
Example
// load a different class instead of what Clarkson Core calculates.
add_filter( 'clarkson_object_type', function( $type, $post ) {
if ( get_post_type( $post ) === 'gm_event' ){
$type = self::OBJECT_CLASS_NAMESPACE . 'custom_event_class';
}
return $type;
}, 10, 2 );