• Hi
    I have a custom post type called asset. it uses the standard wordpress category

    function post_type_asset_page() {
    register_post_type(
    'asset_page',
    array(
    'label' => __('Asset Pages'),
    'description' => __('Create an asset Page.'),
    'public' => true,
    'show_ui' => true,
    'capability_type' => 'post',
    'has_archive' => true,
    'taxonomies' => array('category'),
    'rewrite' => array(
    'slug' => 'asset' // This controls the base slug that will display before each term
    ),
    'supports' => array (
    'title',
    'editor',
    'custom-fields',
    'revisions',
    'thumbnail'
    )
    )
    );
    }
    endif;
    add_action('init', 'post_type_asset_page');

    I have a template called archive-asset.php, but I want to make a page for the category webinar.

    I tried called the template taxonomy-category-webinar.php but that didn’t work. What do I call the template to make a category page for my custom post type?

Viewing 1 replies (of 1 total)
  • Hello mrspabs,

    Actually, you have a custom post type of ‘asset_page’ not ‘asset’.
    Where ‘asset’ is the slug you are using for URL rewriting, and ‘asset_page’ is the post type you have registered. Refer to the register_post_type documentation to see that the first param is the post type.

    That being said, I do not believe that your template approach is accurate.
    You’re attempting to create a custom template for a specific category, where “category” is the built-in category taxonomy, and “webinar” is the category slug (if I understand your attempted approach thus far correctly).

    To create an archive template that targets the category with the slug of webinar, you would create a template named category-webinar.php. Please see the Template Hierarchy documentation regarding category templates.

Viewing 1 replies (of 1 total)

The topic ‘Custom post type with category template’ is closed to new replies.