here is my situation,

I have a Taxonomy menu block built using taxonomy_menu and taxonomy_menu_trails module. And I have used block_term module to display the menu on nodes with given term(s).

Now, how can I display the same taxonomy menu block on taxonomy term pages as well?

I tried adding the taxonomy term page link to display block only the listed pages. but it did not work. while doing this I had both the conditions (Display on nodes that are taged to terms and Show only on listed pages) checked.

2 Answers 2


Well from what I understood from your question, you can use following lines of code in your template file where you want to display the block:

if(arg(0) == 'taxonomy' && arg(1) == 'term') {
  $tid = (int)arg(2);
  $term = taxonomy_term_load($tid);
  $taxo_term = $term->vocabulary_machine_name;

  if ($taxo_term == "your_vocabulary_name") {
    print render($page['your_block_region']);

PS: I dont know if this is very standard(drupal) way to achieve this but it has worked for me.

  • 1
    i think better to check taxonomy term like this -> if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2))) { Commented Dec 12, 2012 at 8:26
  • Thanks @sandesh yadav and #neok, for the quick response.
    – AnAnD
    Commented Dec 12, 2012 at 10:17
  • I am currently using omega theme with context module and I am not sure if I can edit template.php file
    – AnAnD
    Commented Dec 12, 2012 at 10:18
  • I am sorry, I forgot to mention that this issue is for Drupal 7
    – AnAnD
    Commented Dec 12, 2012 at 10:47
  • @AnAnD you can put it on page.tpl.php wherever you want the block to be displayed. :) Commented Dec 12, 2012 at 17:56

Finally this issue is solved using the Context module with Omega theme. (Without need of editing template files)

Step 1: As i mentioned in the question use taxonomy_menu and taxonomy_menu_trails module with block_term module to display the menu on nodes with given term(s). [Now the blocks are displayed only on the nodes tagged to particular term(s)]

Step 2: Using Context add a new context

Step 3: Add a condition as: Taxonomy Term, and select the respective terms where you need the taxonomy block to be displayed.

Step 4: Add a Reaction > Blocks

Step 5: On the right hand side list of blocks are displayed with check boxes. Select the block that you need to show

Step 6: in the middle column all the regions are listed with a [+Add] button. Click on [+Add] button and save the context.

Therefor, now the block(s) is displayed on nodes as well as on the taxonomy term pages too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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