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