WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] query_posts & custom taxonomies (4 posts)

  1. dorian06
    Member
    Posted 4 years ago #

    I would like to display an specific category inside the custom taxonomy.

    Testimonials
    ->Video Testimonials (Tag id = 7)
    ->Quotes Testimonials (Tag id = 6)

    So,
    Taxonomy = Testimonials
    Post Type = Testimonial

    But this, won't work:
    query_posts("post_type=testimonial&tag_id=6");
    Returns both, video and Quotes testimonials.

  2. chinmoy
    Member
    Posted 4 years ago #

  3. dorian06
    Member
    Posted 4 years ago #

    Thx for answer,
    I read the article, but couldn't make it to work, how should I call it?

    $term = get_term_by( 'testimonials', get_query_var( '5' ), get_query_var( 'Testimonials' ) );

  4. chinmoy
    Member
    Posted 4 years ago #

    Don't use $term = get_term_by( 'testimonials', get_query_var( '5' ), get_query_var( 'Testimonials' ) );

    Use this
    $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
    print_r($term);

    query_posts("post_type=testimonial&cat=6");

    or query_posts("post_type=testimonial&cat=". $term->term_id);

Topic Closed

This topic has been closed to new replies.

About this Topic