简体   繁体   中英

Print Taxonomy Term inside Drupal View on Taxonomy Page

I have a taxonomy of 'Market' and on that taxonomy's page, I am using a view. Inside that view, I would like a heading that prints out the taxonomy of the page but I cannot figure out how to access the taxonomy term inside the Views tempate.

In View template you get Taxonomy page data through arguments.

if(arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2))){
  $term_id = arg(2); // Your Term Id
  // if you fetch more data then load the taxonomy
  $term_obj = taxonomy_term_load($term_id);
  print "<pre>";
  print_r($term_obj);
  print "</pre>";
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM