Categories
Development

Theme Fields in Drupal 7

This is so easy now that I know how to do it, but I didn’t realize that fields could be themed similar to nodes.

Just create a template file titled:

field–[field_name].tpl.php

Drupal 7 Content types

and save it in your theme’s directory:

/sites/all/themes/[your_theme]/

You can get the field name on the Content Type screen, Structure > Content types > [your_content_type]

Then you just enter your markup in the field–[field_name].tpl.php file that you’ve created.

You can use the field.tpl.php file located in /modules/field/theme/field.tpl.php as a starting point.

 

Leave a Reply

Your email address will not be published. Required fields are marked *