Question

I have set up a custom post type called products:

add_action( 'init', 'register_cpt_product' );

function register_cpt_product() 
{
    $labels = array(
        'name' => _x( 'products', 'products' ),
        'singular_name' => _x( 'product', 'products' ),
        'add_new' => _x( 'Add New', 'products' ),
        'add_new_item' => _x( 'Add New product', 'products' ),
        'edit_item' => _x( 'Edit product', 'products' ),
        'new_item' => _x( 'New product', 'products' ),
        'view_item' => _x( 'View product', 'products' ),
        'search_items' => _x( 'Search products', 'products' ),
        'not_found' => _x( 'No products found', 'products' ),
        'not_found_in_trash' => _x( 'No products found in Trash', 'products' ),
        'parent_item_colon' => _x( 'Parent product:', 'products' ),
        'menu_name' => _x( 'products', 'products' ),
    );
    $args = array(
        'labels' => $labels,
        'hierarchical' => false,
        'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail' ),
        'taxonomies' => array( 'category', 'post_tag' ),
        'public' => true,
        'show_ui' => true,
        'show_in_menu' => true,
        'show_in_nav_menus' => true,
        'publicly_queryable' => true,
        'exclude_from_search' => false,
        'has_archive' => true,
        'query_var' => true,
        'can_export' => true,
        'rewrite' => true,
        'capability_type' => 'post'
    );

    register_post_type( 'products', $args );
}

The products work with my custom archive page. But not with the categories; I just get a "not found".

http://drysuits.dannycheeseman.me/category/lights/

I have deleted .htaccess and resaved the permalinks.. (/%postname%/)

Any ideas as to why this is happening?

Was it helpful?

Solution

Use for custom taxonomy category list plugin for display category sidebar. or

You can use the wp_list_categories function to create a list in your sidebar, the Codex article has a code example, but something like this should work:

<ul>
<?php wp_list_categories('taxonomy=products'); ?>
</ul> 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top