0

How do I only display individual fields in the ACF Address add on. For example I have three address lines but only want one to be output:

Address Line 1: Curtis Mayfield House
City: Newcastle Upon Tyne
Country: United Kingdom

And I just want to display Address Line 1: Curtis Mayfield House.

Any help would be much appreciated

1 Answers1

0

You can do this by using get_post_meta. The following with get you and array of each field:

$address = get_post_meta(get_the_id(), 'your_acf_field', true);

Then you can use:

echo  $address['city']

This will obviously need to be in your wordpress loop. if you want to use it outside of a loop, simply enter the post ID as the first parameter:

$address = get_post_meta(76, 'your_acf_field', true);

Where "76" is the ID of your post. Hope this helps.

James Kemp
  • 349
  • 1
  • 8