Extended CPTs Extras is a companion package for the Extended CPTs library, providing additional functionality for managing post types in WordPress.
- Featured Image Column Width: Customize the width of the featured image column in the admin list view.
- Remove Meta Boxes: Easily remove unwanted meta boxes from the post edit screen (useful for Gutenberg).
- Register Meta: Register custom meta fields for your post types with support for the REST API.
- Modify Existing Post Types: Add additional features to existing post types, including:
- Custom templates
- Template locking
- Menu position
- Menu icon
-
Require the package in your
composer.json
:{ "require": { "builtnorth/extended-cpts-extras": "^1.0" } }
-
Run
composer install
orcomposer update
.
extended_post_type_extras(['post', 'page'], [
'featured_image_column_width' => 80,
'remove_meta_boxes' => ['postcustom', 'commentstatusdiv'],
'register_meta' => [
'my_custom_field' => [
'type' => 'string',
'description' => 'A custom field for this post type',
'single' => true,
'show_in_rest' => true,
],
]
]);
extended_post_type_modify_existing('post', [
'menu_icon' => 'dashicons-index-card',
'menu_position' => 30,
'template' => [
['core/image', []],
],
]);
Apply extra configurations to specified post types.
Parameters:
$post_types
: String or array of post type names$options
: Array of configuration optionsfeatured_image_column_width
: Set width for featured image columnremove_meta_boxes
: Array of meta box IDs to removeregister_meta
: Array of meta fields to register
Modify existing post types with additional features that are not available in the original Extended CPTs package. This function allows you to apply certain options to existing post types that normally only work when registering a new post type with register_extended_post_type()
. Specifically, it enables you to modify the following attributes for existing post types:
$post_types
: String or array of post type names$options
: Array of configuration optionstemplate
: Custom template for the post typetemplate_lock
: Lock the template to prevent changesmenu_position
: Set the menu positionmenu_icon
: Set the menu icon
Contributions are welcome. Please feel free to submit a Pull Request.
This package is open-sourced software licensed under the MIT license.