Custom Taxonomy Page in Drupal 7

I am trying to create a custom Termonomy Termress page in Drupal 7. I created a page file - taxonomy.tpl.php in my templates folder. The file only displays a message. Now I'm trying to get the template file to add

function template_preprocess_page($variables) {
  if (arg(0) == 'taxonomy') {
    $variables['template_file'] = 'page--taxonomy-tpl';
  }
}

in the template.php file, but this will not work. Could you help me? And if I get a custom page, how do I get nodes with this term (on the page - taxonomy.tpl.php)? Thanks in advance.

+5
source share
4 answers

Try using this in the template.php file:

function template_preprocess_page(&$variables) {
  if (arg(0) == 'taxonomy') {
    $variables['theme_hook_suggestions'][] = 'page__taxonomy';
  }
}
  • You need to pass $variablesby reference, so add a and before it
  • template_file theme_hook_suggestions Drupal 7
  • -tpl , , , "page - taxonomy-tpl.tpl.php", , .

template_preprocess_page(), theme_get_suggestions()

+8

, , D7 - - Drupal / . ( URL- Drupal), , , , .., Views (. " " "" ) ...

+2

Drupal 7, "taxnomy-term.tpl.php" .

. taxonomy-term.tpl.php

0
source

Full control over the taxonomy term page can be obtained using hook_menu_alter (). See https://drupal.stackexchange.com/questions/48420/theming-and-overriding-taxonomy-term-vocabulary-page/111194#111194

0
source

All Articles