Single-{custom-post].php not working
-
Dear,
I create custom post type (Product) using below code. I also create two page, 1. single-product.php and archive-product.php. but when i add some post and click Url my single and archive page not point. page 404 show. I don’t know what i did wrong. My code is below
function ts_post_type_product() { $labels = array( 'name' => __('Product', 'post type general name', 'capiltathemes'), 'singular_name' => __('Product', 'post type singular name', 'capiltathemes'), 'add_new' => __('Add New', 'product', 'capiltathemes'), 'all_items' => __('All Products', 'capiltathemes'), 'add_new_item' => __('Add New Product', 'capiltathemes'), 'edit_item' => __('Edit Product', 'capiltathemes'), 'new_item' => __('New Product', 'capiltathemes'), 'view_item' => __('View Product', 'capiltathemes'), 'search_items' => __('Search Product', 'capiltathemes'), 'not_found' => __('No Product Found', 'capiltathemes'), 'not_found_in_trash' => __('No Product Found in Trash', 'capiltathemes'), 'parent_item_colon' => '', ); $args = array( 'labels' => $labels, 'public' => true, 'show_ui' => true, 'capability_type' => 'post', 'taxonomies' => array( 'product_cats', ), 'hierarchical' => false, 'rewrite' => array('slug' => 'product', 'with_front' => true), 'query_var' => true, 'show_in_nav_menus' => true, 'menu_icon' => 'dashicons-cart', 'supports' => array('title', 'thumbnail', 'excerpt', 'editor', 'author',), ); register_post_type( 'portfolio' , $args ); $rewrite = array( 'slug' => 'product-category', 'with_front' => true, 'hierarchical' => false, ); register_taxonomy('portfolio_cats', array('portfolio'), array( 'hierarchical' => true, 'public' => true, 'label' => 'Product Categories', 'show_admin_column' => 'true', 'singular_label' => 'Category', 'query_var' => true, 'rewrite' => $rewrite, ) ); } add_action('init', 'ts_post_type_product');
Please some one help where the problem is. Why my below URL not working
1.https://localhost/capilta/product
2. https://localhost/capilta/product/1Thanks in Advanced
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Single-{custom-post].php not working’ is closed to new replies.