Support » Plugin: Query Multiple Taxonomies » [Plugin: Taxonomy Drill-Down] How to display tag's name of the 2nd taxonomy requested in url ?

  • Resolved bouddhalight

    (@bouddhalight)


    Hi,

    I have a custom post type with many many taxonomies. This is why I use this plugin.

    Here is my problem, For example :
    http://www.mywebsite.com/?taxonomyA=term1&taxonomyB=term2

    I would like to display (in my header.php template) the tag’s name of only taxonomyB is it requested in url.

    I tried to use the following lines of code but it doesn’t work :

    if (is_multitax( array(‘taxonomyB’) )) {
    $taxonomyB_term = get_term_by( ‘slug’, get_query_var(‘term’), get_query_var(‘taxonomyB’) );
    echo $term->name;
    }

    If anyone knows… ? :/

    Thanks!
    Bouddhalight

Viewing 5 replies - 1 through 5 (of 5 total)
  • Ok, I got it.

    if (is_multitax( array('taxonomyB') )) {
    foreach (qmt_get_query() as $tax => slug) {
      $tag = get_term_by( 'slug', $slug, $tax );
      if ( $tag->taxonomy == "taxonomyB") {
        echo $tag->name;
      }
    }

    [Please post code snippets between backticks or use the code button.]

    the foreach missed. ^^

    Plugin Author scribu

    (@scribu)

    Glad to see you’ve managed on your own. 🙂

    Note that that if (is_multitax( array('taxonomyB') )) { check will not work for this url:

    ?taxonomyA=term&taxonomyB=another-term

    You can just remove the if check and it should work as expected.

    Thanks Scribu 🙂

    I have another question:
    I have to implement a menu “cities”. The user can choose a city (or not) wich is a term of “city” taxonomy.
    So the url could be like that :
    http://www.website.com/city/city-term

    How can i set up your plugin to consider the city term ? 🙂

    Scribu ? please… 😀

    I create new topic for the last question.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Taxonomy Drill-Down] How to display tag's name of the 2nd taxonomy requested in url ?’ is closed to new replies.