0

I have a view which lists dishes by category. Category is a tag ("main", "soup", etc). I use grouping fields, and what i wanted is to make a kind of anchor menu for this view. Is it possible to style the grouping fields?
Right now, grouping fields are in h3 headers, just before the relevant views rows. Is it possible to rewrite them,or alter their structure?

1 Answer 1

2

You have to override the view template.

In your views UI click on 'Theme:information'. This will open up a dialog with views templates and suggestions. As your view is using grouping, you need to override the 'Style output' theme template as it is the one that contains the h3 tag you want to alter. When you click on the blue 'Style output' link it will open up a dialog with the code you can copy and alter. That code needs to go into a file placed within the template's folder of your theme. The file name must be selected from the list of suggestions in the same line next to the blue 'Style output' link. First in the list is:

views-view-list.tpl.php

If you override that template it will override it for all views of HTML List format, so you now have to select a more targeted suggestion. Going down the list you will see how different template suggestions target different contexts.

Have a look at this question for more information: Commerce Product Collection View Block: What Determines CSS For Each Header Link?

1
  • great! I was able to style it, and thanks to the transliteration module I was able to give the tag a content - relevant class. :-)
    – Dalmaz
    Sep 17, 2014 at 8:19

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.