Drupal 7
I am attempting to print just the city value within the location array.
I have created a content type with location and created a custom node template node--content.tpl.php. Inside of my if ($teaser) statement I have the following code:
hide($content['field_event_location']);
print render($content)
Which effectively hides the full field_event_location and renders all other content listed in the display settings of drupal 7 admin. I am attempting to render the city field with the following line:
print render($content['field_event_location']['und'][0]['city'])
I used
print_r($content);echo
to print the array with the following results:
[field_event_location] => Array ( [und] => Array ( [0] => Array ( [lid] => 167 [street] => 4501 Main Street [additional] => [city] => Kansas City [province] => [postal_code] => 64130 [country] => us [source] => 3 [is_primary] => 0 [province_name] => [country_name] => United States [email] => [phone] => ) ) )
I did some basic de-bugging I found from this post (How to print render Location's sub-fields?), and was able to print render($content['body'])
as well as get the full location output from print render($content['field_event_location'])