Monday, 6 June 2016

Create page tpl for taxonomy vocabulary

How to create page tpl for taxonomy vocabulary



Solution:

find for themename_preprocess_page add this is template.php

if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2)))
{
    $tid = arg(2);
   
    $vid = db_query("SELECT vid FROM {taxonomy_term_data} WHERE tid = :tid", array(':tid' => $tid))->fetchField();
   
    $vars['theme_hook_suggestions'][] = 'page__vocabulary__'.$vid;
}

now create tpl named as "page--vocabulary--X.tpl.php";
banner
Previous Post
Next Post

0 comments: