0
votes

assuming this is my custom post type code, on my own theme:

    register_post_type( 'wpmon-product',
        array(
            'labels' => array(
                'name' => __( 'My Store' ),
                'singular_name' => __( 'Product' ),
                'add_new' => __( 'Add New Products' ),
                'add_new_item' => __( 'Add New Products' ),
                'edit_item' => __( 'Edit Products' ),
                'new_item' => __( 'Add New Products' ),
                'view_item' => __( 'View Products' ),
                'search_items' => __( 'Search Products' ),
                'not_found' => __( 'No products found' ),
                'not_found_in_trash' => __( 'No products found in trash' )
            ),
            'public' => true,
            'supports' => array( 'title', 'editor', 'thumbnail', 'comments' ),
            'rewrite' => array("slug" => 'product'),
            'menu_position' => 5,
            'register_meta_box_cb' => 'my_custom_metaboxes'
        )
    );

on my themeplate folder: what should be the name of my single.php php? is it 'single-wpmon-product.php'? or 'single-product.php'

i tried it both.. but it doesnt work on :(

2

2 Answers

1
votes

The template does indeed need to be single-wpmon-product.php. As you have probably already seen, the WordPress Codex gives you the guidelines here: http://codex.wordpress.org/Post_Type_Templates. I've created your custom post_type locally and that template file name works for me.

I'm not sure why it's not working for you. Are you sure you are creating these posts inside of My Store and not Posts?

0
votes

the single page name depends on the name of custom post type you Registered . so your single template file for this post type must be single-wpmon-product.php .

maybe you forgot to call the registration function in "init hook". for example if the function name is : function register_myposttype() ;

so you must call it as add_action( 'init', 'register_myposttype' );