WordPress.org

Forums

[resolved] Displaying custom post types on category pages (3 posts)

  1. Ameisenman
    Member
    Posted 4 years ago #

    Hi,
    I searched the web and didn't found an answer to my question: I created some custom post types with the register_post_type function and gave them the taxonomies 'category' and 'post_tag'. All goes well but when I try to open a category which holds the custom post type pages there is no post, nothing.
    How can get it to work? I mean, how to display those custom post type posts on the category/archive pages?

    Thanx

  2. Rev. Voodoo
    Volunteer Moderator
    Posted 4 years ago #

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

    you have to query the custom post type, this is mine to display ve_products

    you will need to array your custom post type with post if you want bot normal posts and custom post types to display

    'post_type' => array('post', 've_products'),

  3. Ameisenman
    Member
    Posted 4 years ago #

    Thanx a lot! In conjunction with the ability of WordPress to give categories a different template (e.g. category-products.php), I managed it!!! Great!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.