I would like to override the standard /taxonomy/term/% view for certain terms in a given vocabulary in two situations: one is for a given term, another is for all childs of a given term (so if and only if the current term has XXX has parent, the view must be triggered°.

When one of the condition above is met, then this view must be triggered, the standard view must be displayed otherwise.

What is the proper way to achieve this?


Example: Standard taxonomy page orders teasers by published date and it is generally what I need except for all the children of the term "Regions" (Africa, Asia, Caribbean,...) where I need to order them by Country and provide exposed filters.

I don't want to create a view for each of those terms. I would like to create a view that is triggered only when the parent term is Regions. In all other cases, the standard /taxonomy/term/% view must be rendered.

  • can you give a concrete example of what you are trying to accomplish?
    – Jimajamma
    Jul 22, 2012 at 16:52
  • I have added an example in the edit.
    – znat
    Jul 22, 2012 at 19:53

2 Answers 2


I don't know if this is the 'right' way to do it, but I often need to do something very similar and achieve it by overriding the page callback for the standard taxonomy term page.

This involves implementing hook_menu_alter() like so:

function MYMODULE_menu_alter(&$items) {
  $items['taxonomy/term/%taxonomy_term']['page callback'] = 'MYMODULE_taxonomy_page';

Then you would provide a page callback which sees which vocabulary the current term belongs to, and makes a decision about whether to serve the standard taxonomy page or a view:

function MYMODULE_taxonomy_page($term) {
  $build = array();

  // If we're on some vocabulary, serve a view
  if ($term->vid == function_to_get_vid()) {
    $build['term_page'] = array(
      '#markup' => views_embed_view('name_of_view', 'name_of_display', $arg1, $arg2)
  else {
    module_load_include('inc', 'taxonomy', 'taxonomy.pages');
    $build['term_page'] = taxonomy_term_page($term);

  return $build;
  • I was hoping for an out of the box solution but I am gonna try your way. I am not a Drupal developer so I don't know where these snippets should go. A new custom module?
    – znat
    Aug 2, 2012 at 17:42

In D6, the taxonomy term page is themed by default with a function, but it can be overridden by creating a template in your theme called taxonomy_term_page.tpl.php (or of course writing your own function if you want).

In D7, it provides a default taxonomy-term.tpl.php that can be copied to your theme and modified.

So, you would have to look to see what term is being displayed and if it's one of the ones you want customized, embed your view output for it; otherwise, let taxonomy do it's thing by default.

There is good commentary in the D7 template that should make that pretty straightforward. In D6, there is a Crazy-Awesome Taxonomy Pages Video with Bob from Mustardseed Media that I found to be quite helpful but there you basically have a $tids array that you can look at to decide what to do.

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.