• In WordPress 3.0 it’s possible to create custom post types. I have created a custom post type named “products”. I can then create a file called single-products.php to structure the view of the product posts (eg. /products/my_product).

    But what if I would like to create a page displaying all product-posts (eg. /products) just like the normal category pages. How can I do that? I’m using the new Custom menu as well.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter DennisMadsen

    (@dennismadsen)

    Well, I know how to create the query. But my question is more about, in which file etc. I should create it.

    I can create eg. a template-products.php which create a template for my product archive. Next a create a new page and assign this template. But I don’t know if there are better ways to do it?

    Nope, that’s how it’s done

    I made a template file called shop.php to hold all my products, made a page called shop, assigned it that template, and made that template query the posts from that custom post type

    Also, just a tip as it’s something I forgot about for a while…. pagination won’t work properly on your page template without accounting for it….I use this in my query

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts(array(
    	'post_type' => 've_products', // custom post type
             'paged'=>$paged,
            ));
    ?>

    without including pagination on your query, every page will display the first page of custom posts…..

    Thread Starter DennisMadsen

    (@dennismadsen)

    I’ve added this to my theme function.php:

    function demaweb_post_type() {
    	register_post_type( 'demaweb_product',
    		array(
    		  'labels' => array(
    			'name' => __( 'Products' ),
    			'singular_name' => __( 'Product' ),
    		  ),
    		  'public' => true,
    		  'rewrite' => array('slug' => 'products'),
    		)
    	);
    }
    
    add_action( 'init', 'demaweb_post_type' );

    But when I go to post -> add new I cannot find a box, where I can select the post type. Where can I find that?

    Thread Starter DennisMadsen

    (@dennismadsen)

    Well, I found it ?? It has a separate menu..

    Thread Starter DennisMadsen

    (@dennismadsen)

    I’ve got a problem.

    I’m using the Breadcrumb NavXT plugin. If I visit one of my products, eg. /products/cms/, which is a custom post type, the breadcrumb outputtet is only:
    Home > CMS

    I would like it to include my product archive into the breadcrumb:
    Home -> Products -> CMS

    How can I do that?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Custom post type: catalog page’ is closed to new replies.