The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

[resolved] get custom category by name and display the custom post_type (3 posts)

  1. Cammy_WP
    Posted 5 years ago #

    I have a custom post_type

    register_post_type('specials', $items);
    		register_taxonomy('type', array('specials'), array('hierarchical' => true, 'label' => 'Type', 'singular_label' => 'Type', 'show_ui' => true, 'query_var' => true, 'rewrite' => true));

    I have problem with getting a post from a specific category "type".

    with <?php query_posts('post_type=specials') ?> i get all the post from the post_type specials, but that is not what i need.

    in the category type i added Item1 and item2, slugname are item-1 , item-2

    i need to get the category/taxonomy of type by slugname (item-1)and then display all the relevant post of it. but i cant find the correct code for it.

    Can someone throw me a good example ?


  2. Bill Erickson
    Posted 5 years ago #

    So you have this setup:
    post type = specials
    taxonomy = type
    taxonomy items = item-1 and item-2

    If you wanted to list all posts "item-1" you could use this:


    Does that help?

  3. Cammy_WP
    Posted 5 years ago #

    Yes! Marvelous! Works like charm <3

Topic Closed

This topic has been closed to new replies.

About this Topic