Monday, 19 October 2015

How to Create Custom Post Type?

add_action( 'init', 'my_cpt_init' );
function my_cpt_init() {
    register_post_type('product',
    array(
        'labels'              => array(
        'name'               => _('Products'),
        'singular_name'      => _('Product')
        ),
        'public'             => true,
        'has_archive'        => true,
        'supports'           => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
        )
    );   
}

No comments:

Post a Comment