Search
 
SCRIPT & CODE EXAMPLE
 

PHP

register_post_type wordpress

function create_custom_post_type() {
    register_post_type(
        'posttype', // post type name
        // CPT Options
        array(
            'labels' => array(
                'name' => __('Posttypes'), // title
                'singular_name' => __('Posttype') // editor right sidebar title
            ),
            'public' => true,
            'has_archive' => true,
            'show_in_rest' => true,
            'hierarchical' => true,
            'rewrite' => array('slug' => 'posttype'),
            'supports' => array(
                'title',
                'editor',
                'thumbnail',
                'page-attributes',
                'revisions',
                'trackbacks',
                'excerpt',
                'comments',
                'author',
            ),
            'capability_type' => 'post',
            'taxonomies' => array('category')
        )
    );
}
add_action('init', 'create_custom_post_type');
Comment

wordpress register post type

function book_setup_post_type() {
    $args = array(
        'public'    => true,
        'label'     => __( 'Books', 'textdomain' ),
        'menu_icon' => 'dashicons-book',
    );
    register_post_type( 'book', $args );
}
add_action( 'init', 'book_setup_post_type' );
Comment

PREVIOUS NEXT
Code Example
Php :: @include laravel 
Php :: how to send ajax request in laravel 
Php :: php convert object to array nested 
Php :: twig is in string 
Php :: php eliminar elementos vacios array 
Php :: connect to sql database 
Php :: php check string is int 
Php :: how to zip a folder using php 
Php :: save an image use php 
Php :: php sort multi dimensional array 
Php :: laravel model update 
Php :: each in laravel 
Php :: laravel unique multiple columns 
Php :: php artisan update table 
Php :: snap store phpstrom 
Php :: php artisan migrate single file 
Php :: delete bunch of rows in laravel 
Php :: add class to body class wordpress 
Php :: php begin 
Php :: create seed file laravel 
Php :: how to remove null values in array php 
Php :: File Reading Mode PHP 
Php :: do while php 
Php :: find substring regx php 
Php :: datetime validation in laravel 
Php :: laravel read file from tmp 
Php :: how to collapse array in laravel 
Php :: Type cast using double php 
Php :: transform text to lowercase and replace space with dash php 
Php :: How to write a loop in PHP 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =