I am trying to create CPT , I added this to custom.php but can view the post. It just show 404 page.
/**Add New Custom Post Type**/
function my_custom_post_product() {
$labels = array(
'name' => _x( 'Projects', 'post type general name' ),
'singular_name' => _x( 'Projects', 'post type singular name' ),
'add_new' => _x( 'Add New', 'book' ),
'add_new_item' => __( 'Add New Project' ),
'edit_item' => __( 'Edit Project' ),
'new_item' => __( 'New Project' ),
'all_items' => __( 'All Project' ),
'view_item' => __( 'View Project' ),
'search_items' => __( 'Search Project' ),
'not_found' => __( 'No products found' ),
'not_found_in_trash' => __( 'No products found in the Trash' ),
'parent_item_colon' => '',
'menu_name' => 'Projects'
);
$args = array(
'labels' => $labels,
'description' => 'Holds your Project data',
'public' => true,
'menu_position' => 5,
'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),
'has_archive' => true,
);
register_post_type( 'product', $args );
}
add_action( 'init', 'my_custom_post_product' );