apply_filters( 'clarkson_core_{$post_type}_templates', $post_templates, $theme, $post, $post_type ) → {Array.<string>}
Manipulate which post_types get a template in the template dropdown.
Parameters:
Name | Type | Description |
---|---|---|
$post_templates |
Array.<string> | Which post types the template can be chosen on. |
$theme |
WP_Theme | The theme posts are shown on |
$post |
WP_Post | null | The current post. |
$post_type |
string | The post type (already known from hook). |
- Since:
- 0.2.1
- Source:
Returns:
Template files as key with their display name as value.
- Type
- Array.<string>
Example
// Show a custom template in the 'sponsored_post' post-type template dropdown.
add_filter( 'clarkson_core_sponsored_post_templates.twig', function($post_templates){
$post_templates['template-example.twig'] = 'Example template';
return $post_templates;
} );