PostType
in package
Post type.
Creates a single custom post type.
Table of Contents
Methods
- __construct() : mixed
- Constructor method.
- register_post_type() : mixed
- Registers the custom post type.
- set_args() : mixed
- Sets arguments for registering the post type.
- set_labels() : mixed
- Sets labels for the post type.
Methods
__construct()
Constructor method.
public
__construct(string $slug, array<string|int, mixed> $args) : mixed
Parameters
- $slug : string
-
Slug of the post type.
- $args : array<string|int, mixed>
-
{ Array of args to build the post type.
@type string $singular_name The singular name of the post type. @type string $plural_name The plural name of the post type. @type bool $show_in_menu Whether to display the post type in the admin menu. @type bool $public Whether the post type is intended to be publicly queryable. @type bool $has_archive Whether the post type should have an archive page. @type array $supports An array of features supported by the post type. @type bool $exclude_from_search Whether to exclude the post type from front-end search results. @type bool $publicly_queryable Whether the post type is intended to be queried publicly (in front-end queries). @type bool $show_in_nav_menus Whether to include the post type in navigation menus. @type bool $show_in_rest Whether the post type is available in the REST API. @type string $required_component The component required for this post type. @type string $menu_icon The menu dashicon.}
register_post_type()
Registers the custom post type.
public
register_post_type() : mixed
set_args()
Sets arguments for registering the post type.
public
set_args(mixed $args) : mixed
Parameters
- $args : mixed
set_labels()
Sets labels for the post type.
public
set_labels(mixed $args) : mixed
Parameters
- $args : mixed