Tuesday, October 30, 2018

Wordpress custom posttype

add_theme_support('post-thumbnails');
add_post_type_support( 'my_product', 'thumbnail' );   
function create_post_type() {
        register_post_type( 'my_product',
            array(
                'labels' => array(
                    'name' => __( 'Products' ),
                    'singular_name' => __( 'Product' )
                ),
                'public' => true,
                'has_archive' => true
            )
        );
    }
    add_action( 'init', 'create_post_type' );

No comments:

Post a Comment

Please mention your comments.......