Hi. What is PHP code for displaying block only on term view when viewing any term from vocabulary id = 1 for D6? Thx

Comments

vikramy’s picture

Sound’s picture

Yes I found this but this don't work for me I need displaying block only for term view (taxonomy/term/%) but not for content types and not by path but by vid=1. Thanks anyway. Maybe there is some module which extends block visibility settings by vocabularies?

Sound’s picture

Can anyone help me? Please:)

jdln’s picture

Subscribing.

Sound’s picture

The code is:

$desired_vocab = 1; // put here the vocabulary ID you're interested in

  if ( ((arg(0) == 'taxonomy')
     && (arg(1) == 'term')
     && is_numeric(arg(2))
     && ($term = taxonomy_get_term(arg(2)))
     && ($term->vid == $desired_vocab )) ) {
        return TRUE;
  }

Thanks.

jdln’s picture

This doesn't work for me. I have 2 vocabularies, and all nodes have a tag from each vocab. The code above makes the view show up on any term page.

This happens even If i change the ID to one that doesn't exist.
Thanks

1mundus’s picture

This one worked for me, thanks! It displays the block only on term pages inside of desired vocabulary.

meytad’s picture

Worked for me too! Thx