-
Notifications
You must be signed in to change notification settings - Fork 0
Post Type
rogertm edited this page Oct 16, 2023
·
5 revisions
Para crear nuevos post types debemos crear una clase extendida de WASP\Posts\Post_Type.
<?php
use WASP\Posts\Post_Type;
class My_Plugin_Custom_Post_Type extends Post_Type
{
function __construct()
{
parent::__construct();
// CPT slug
$this->post_type = 'my-cpt-slug';
// CPT labels
$this->labels = array( ... );
// CPT arguments
$this->args = array( ... );
}
}
new My_Plugin_Custom_Post_Type;La propiedad labels hace referencia a $args['labels'] en la función register_post_type(), args al resto de los argumentos pasados a esta función.
- Function
register_post_type().