How to create custom post type & template for my product

All QuestionsCategory: WordPressHow to create custom post type & template for my product
S M Hasibul Islam Staff asked 3 years ago

I want to create custom post type for my product & How I use this on single & archive page? I am currently trying to use WOrdPress custom post types to create a product system currently.

function codex_custom_init() { 
 $args = array( 'public' => true, 'label' => 'Books' ); 
 register_post_type( 'book', $args ); 
} 
add_action( 'init', 'codex_custom_init' );

Is this perfect?

1 Answers
S M Hasibul Islam Staff answered 3 years ago

Here you can find all solution of your problem. How to create custom post type

function codex_custom_init() {
    $args = array(
      'public' => true,
      'label'  => 'Books'
    );
    register_post_type( 'book', $args );
}
add_action( 'init', 'codex_custom_init' );