I'm working on a glossary view. I have created letter headers by rewriting a copy of the term title, limiting it to 1 character, excluding it from display, and using that as the "Group By" field. The field is then shown by Views, but it doesn't contain the <h2> tag that I wrapped around the field in the rewrite rules. The normal term titles are output (by default) with <h3> tags. I would like the letter headers to be larger, but since Views seems to be overriding everything, I can't see how to do accomplish this. It doesn't even output the class name I attached to the field.

Any ideas? Your help is appreciated!

1 Answer 1


Under the advanced tab you can see what templates you need to override the views template. Copy the templates mentioned from the modules/views/themes folder to you own theme/templates folder, rename them as the view suggests under advanced and style your output.

note: if you display a teaser or full node, but forced it to use fields, the styling (making it h3) won't work.

The h3 is coded in views-view-unformatted-list.tpl.php. The $title there is output of the field you grouped by. There you can set it to h2.

UPDATE: This is the default views template for outputting lists (the container which contains all rows as a group). This one is named views-view-unformatted.tpl.php, you need to rename it to match with your view.


 * @file
 * Default simple view template to display a list of rows.
 * @ingroup views_templates
<?php if (!empty($title)): ?>
  <h3><?php print $title; ?></h3> // THIS IS THE GROUPNAME
<?php endif; ?>
<?php foreach ($rows as $id => $row): ?> // THESE ARE THE ROWS INSIDE THE GROUP
  <div<?php if ($classes_array[$id]) { print ' class="' . $classes_array[$id] .'"';  } ?>>
    <?php print $row; ?>
<?php endforeach; ?>

If you want to put style on ALL the rows inside the group then you can use the view-ui itself, or use the template called views-view-fields.tpl.php to override all rows.

If you want to style ONE specific row use views-view-field.tpl.php (note there is no 's' behind field).

  • Wouldn't that display every title as an H2, instead of just the grouping field? I tried copying views-view-field.tpl.php and naming it views-view-field--glossary--title-1.tpl.php (the View and field names), but the only thing in that template is <?php print $output; ?>
    – eljefejb
    May 2, 2014 at 20:08
  • No I make an answer of it and you will see
    – Marcel
    May 3, 2014 at 7:39

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.