Metaboxes
in package
Post type.
Creates a single custom post type.
Table of Contents
Properties
- $post_type : string
- Post type.
Methods
- __construct() : mixed
- Constructor
- meta_group() : mixed
- Generates group of meta fields.
- metabox_callback() : mixed
- Generates a metabox group for the specified post.
- register_metaboxes() : mixed
- Registers the metaboxes.
- save_meta() : mixed
- Saves meta values.
Properties
$post_type
Post type.
public
string
$post_type
The post type to which the metaboxes belong.
Methods
__construct()
Constructor
public
__construct(mixed $post_type) : mixed
Parameters
- $post_type : mixed
Tags
meta_group()
Generates group of meta fields.
public
meta_group(object $post, array<string|int, mixed> $data) : mixed
Parameters
- $post : object
-
The current post being edited.
- $data : array<string|int, mixed>
-
Array of metabox data. @see metabox_callback()
Tags
metabox_callback()
Generates a metabox group for the specified post.
public
metabox_callback(WP_Post $post, array<string|int, mixed> $metabox) : mixed
Parameters
- $post : WP_Post
-
The post object being edited.
- $metabox : array<string|int, mixed>
-
{ Arguments passed from add_meta_box().
@type string $category The name of the metabox group. @type string $post_type The post type slug. @type array $data { Contains metabox data for the post type. @type array $tables { Information for each metabox table group. @type string $description Optional. A description for the entire metabox table. @type array $meta { An associative array of fields for each metabox table, keyed by field key. @type string $label The label for the field. @type string $description Optional. A description of the field. @type string $type The field type. Accepts 'dropdown', 'checkboxes', 'input'. @type array $options Optional. The available options for 'dropdown' or 'checkboxes' fields. } } }}
Tags
register_metaboxes()
Registers the metaboxes.
public
register_metaboxes() : mixed
Tags
save_meta()
Saves meta values.
public
save_meta(int $post_id) : mixed
Parameters
- $post_id : int
-
The ID of the post being saved.