How do I make a template for items with custom post type?
-
Hello,
I have created a custom post type using the following code./* Product Post Type */ add_action('init', 'Product_post_type_init'); function Product_post_type_init() { $labels = array( 'name' => _x('Product', 'post type general name'), 'singular_name' => _x('Product', 'post type singular name'), 'add_new' => _x('Add New', 'Product'), 'add_new_item' => __('Add New Product'), 'edit_item' => __('Edit Product'), 'new_item' => __('New Product'), 'view_item' => __('View Product'), 'search_items' => __('Search Products'), 'not_found' => __('No Products found'), 'not_found_in_trash' => __('No Products found in Trash'), ); $args = array( 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, //false - to hide from the admin area menu 'rewrite' => true, 'query_var' => true, 'capability_type' => 'post', 'hierarchical' => true, //allow parent pages 'show_in_nav_menus' => false, 'menu_position' => 1000, 'taxonomies' => array('category'), 'supports' => array( 'title', 'editor', 'page-attributes' ) ); register_post_type('Product',$args); }
What I’m now trying to do is create a template for all posts that use that post type. How do I go about doing this.
From what I’ve read I came up with naming the file single-Product.php but that didn’t work. What am I doing wrong?
Thanks in advance for your help.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How do I make a template for items with custom post type?’ is closed to new replies.