Using Drupal 7 with Address Field module. How to prevent the country part of the address field from displaying on a node with an address field?

For example, address is:

123 Main St
Somewhere, NY 10001
United States

I want the node to show:

123 Main St
Somewhere, NY 10001

3 Answers 3


I overrode the field.tpl.php file as described in this video:

Drupal 7: Theming Fields and Nodes with Templates by linwclark

I copied the field.tpl.php file from <site_root>/modules/field/theme/field.tpl.php and put it into the templates directory of my zen subtheme (<site_root>/sites/all/themes/somezentheme/templates/field--field_address.tpl.php)

In that template I used the hide() function on country:

  <div class="field-items"<?php print $content_attributes; ?>>
    <?php foreach ($items as $delta => $item): ?>
    <div class="field-item <?php print $delta % 2 ? 'odd' : 'even'; ?>"<?php print $item_attributes[$delta]; ?>><?php hide($item['country']); print render($item); ?></div>
    <?php endforeach; ?>

You have to use hook_field_formatter_view to display it as you need.

  • Can you elaborate?
    – User
    Commented Jan 11, 2012 at 0:17

you could also hide it with css. I use css_injector module to just insert the css on the page(s) where you want to hide the element.

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.