WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. Cammy_WP
    Member
    Posted 3 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 ?

    Thanks!

  2. Bill Erickson
    Member
    Posted 3 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:

    query_posts('post_type=specials&type=item-1');

    Does that help?

  3. Cammy_WP
    Member
    Posted 3 years ago #

    Yes! Marvelous! Works like charm <3

Topic Closed

This topic has been closed to new replies.

About this Topic