• Hi,

    the title didnt go that much into detail but i dont know how to describe it correctly. Heres my Problem:

    I got a custom post type named ‘fruitshop’. What i also got is a registered taxonomy with the name ‘fruits’. Now on the template for the fruitshop i list the taxonomy terms in a dropdown with:
    <?php wp_list_categories('orderby=id&&use_desc_for_title=0&taxonomy=fruits&title_li='); ?>

    Thats works pretty well. If i choose for example ‘banana’ out of the dropdown it redirects to fruitshop/fruits/banana. (fruitshop/fruits) is my rewrite slug.

    The Problem now is that i get all fruits displayed instead of just bananas. How do i get the term that i just selected in the dropdown, thats my big question. I used alot get_term and get_term_by etc. but nothing seems to work proberly.

    ps: Thats how it works if i enter my term manually

    $args = array(
        'post_type' => 'fruitshop',
        'fruits' => 'bananas'
    );
    $query = new WP_Query( $args );

    So the only thing i need to know is how do i get the term that i selected? Maybe iam missing something. 🙂

    Thanks a lot in advance for any help!!

    Bye,Michael

Viewing 1 replies (of 1 total)
  • Thread Starter paperboy123

    (@paperboy123)

    Got it myself 🙂

    in my ‘taxonomy_fruits.php’ that line gives me the term.

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

    With this i can get the slug for my term using $term->slug;

    greets

Viewing 1 replies (of 1 total)
  • The topic ‘Taxonomy Problem’ is closed to new replies.