Drupal Answers Asked by user3027413 on December 21, 2021
I’m struggling theming the taxonomy-term page and since i’m not really getting anywhere, i now embedded two blocks (created with views) in my taxonomy-term.tpl.php. Now, that views is showing everything the way I want it, I don’t want the term page itself output its data.
That’s why I’m trying codes like
<?php hide($content); ?>
But that won’t do the trick. How can I just show the Blocks from Views instead of the content taxonomy provides itself?
Thanks!
Use Display Suite to manage your display and show/hide fields for Taxonomy terms. You can actually display nothing. Then add the blocks in there.
Second option is alter taxonomy term page.tpl.php - a function that you need to add in template.php within your theme directory.
This is a function for templating pages for content types or terms. Second part defines page--taxonomy--term.tpl.php suggestion. It worked for me.
<?php
/**
* Add / modify variables before the page renders.
*/
function YOURTHEMENAME_preprocess_page(&$vars) {
// custom content type page template
// Renders a new page template to the list of templates used if it exists
if (isset($vars['node']->type)) {
// This code looks for any page--custom_content_type.tpl.php page
$vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type;
}
if(arg(0) == 'taxonomy' && arg(1) == 'term') {
$tid = (int)arg(2);
$term = taxonomy_term_load($tid);
if(is_object($term)) {
$vars['theme_hook_suggestions'][] = 'page__taxonomy__'.$term->vocabulary_machine_name;
}
}
}
?>
I hope it helps. A while ago, I've been looking for this solution for days!
Answered by designarti on December 21, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP