2

I have taxonomy term list page..

  • Apple
  • Banana
  • Sweets
  • Cake

These are the terms listed with links to default term page.

suppose I want to remove the link for Apple only but listed how do I go about it?

I have tried this

  function mytheme_node_view($node, $view_mode, $langcode) {
    if (isset($node->content['field_fruit_name'])) {
      foreach ($node->content['field_fruit_name']['#items'] as $delta => $item) {
         if (count(taxonomy_select_nodes($item['taxonomy_term']->tid)) < 2) {
           $title = $node->content['field_fruit_name'][$delta]['#title'];
           $node->content['field_fruit_name'][$delta] = array();
           $node->content['field_fruit_name'][$delta]['#markup'] = $title;
         }
      }
    }
  }

its not working... so if i can remove the link for each term individually it would be great.

2
  • Term list page created by views?
    – DRUPWAY
    Feb 9 '17 at 5:53
  • I mean to say Taxonomy terms Listed on a page using views. Feb 9 '17 at 5:58
2

Little bit tricky but you can achieve without code.

  1. Add a new boolean field to taxonomy term.(eg: show link(field name))

enter image description here

Save for each term show link value either true or false. Depend you wants to show the link or hide the link for that term.

  1. Add three fields like shown in the image in your views.

enter image description here

  1. Taxonomy term: Name [hidden] -- Exclude from display and deselect link to taxonomy term

enter image description here

  1. Taxonomy term: Term ID [hidden] -- Exclude from display

enter image description here

  1. Taxonomy term: show link

enter image description here

enter image description here enter image description here

4
  • did it as you said --- checking the the box on/off does nothing... the links are still there. Feb 9 '17 at 6:43
  • you can see the answer and let me know anything not clear.
    – DRUPWAY
    Feb 9 '17 at 6:55
  • let me try -- ill let you know Feb 9 '17 at 6:59
  • thank you for the help --- unfortunately I haven't been able to implement it... is there away to implement with code. Feb 9 '17 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.