Is it possible to display taxonomy terms above node title using this module?

Comments

Eliza’s picture

Or some other way to get this, does anyone know?

rstamm’s picture

It's not possible. The best way is to customize node.tpl.php and page.tpl.php

Eliza’s picture

When I try to put terms above title in node.tpl.php, terms just disappear. And what to do with page.tpl.php is beyond my mind...

rstamm’s picture

Status: Active » Fixed

for a node teaser list page customize node.tpl.php.

Garland theme -> node.tpl.php

...
<?php if ($page == 0): ?>
  <div class="clear-block">
    <div class="meta">
    <?php if ($taxonomy): ?>
      <div class="terms"><?php print $terms ?></div>
    <?php endif;?>
    </div>
  </div>

  <h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php endif; ?>
...

and for a single node page customize copy page.tpl.php to page-node.tpl.php

Garland theme -> page-node.tpl.php

...
<?php print $breadcrumb; ?>
<?php if ($mission): print '<div id="mission">'. $mission .'</div>'; endif; ?>

<?php if ($terms): print '<div id="terms">'. $terms .'</div>'; endif; ?>

<?php if ($tabs): print '<div id="tabs-wrapper" class="clear-block">'; endif; ?>
<?php if ($title): print '<h2'. ($tabs ? ' class="with-tabs"' : '') .'>'. $title .'</h2>'; endif; ?>
...

and template.php

function phptemplate_preprocess_page(&$vars) {
...

  foreach (taxonomy_node_get_terms($vars['node']) as $term) {
    $terms[] = l($term->name, 'taxonomy/term/'. $term->tid);
  }
  $vars['terms'] = theme('item_list', $terms);

...
}

i don't know your theme but may be you have to customize CSS too

Eliza’s picture

Got just what I wanted! Thank you so much for detailed answer!
I also had to delete

<?php if ($terms): ?>
    <div class="terms terms-inline"><?php print $terms ?></div>
  <?php endif;?>

in node.tpl.php to prevent terms from output twice.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

mariner702’s picture

I get Drupal’s default style tags above the title and not this module’s style. I would like to see “Custom’s” style above the title. Please help.

kbeck303’s picture

Issue tags: +page.tpl.php, +taxonomy terms

It took a long time to finally come across this solution. It worked great. Thank you!