Get Value From an Array in a Looper

I’m creating a layout template for single members in a directory. Among the values I’d like to display is the member’s location address.

I used a text object and added this meta key value of the field {{dc:post:meta key="_drts_location_address"}}. This sort of worked but ended up display a bunch of values below:

I only want to display 8 Gateway Lane , Beverly, Massachusetts 1915, United States not the full array of values.

The meta key is _drts_location_address. This is the array connected to it :

array (
  0 => 
  array (
    'address' => '8 Gateway Ln, Beverly, MA 01915, USA',
    'street' => '8 Gateway Lane',
    'street2' => '',
    'city' => 'Beverly',
    'province' => 'Massachusetts',
    'zip' => '1915',
    'country' => 'US',
    'timezone' => '',
    'zoom' => 10,
    'lat' => 0.0,
    'lng' => 0.0,
    'term_id' => 0,
    'display_address' => '8 Gateway Lane , Beverly, Massachusetts 1915, United States',

How do I show the display_address?

Hey @santosfel5,

Thanks for reaching out!

Please check this thread on how to get the value in an array.

Hope that helps.

Isn’t this solution for pre-provided values in an array? The layout I’m creating needs to dynamically pull in these values for each member listing. I did try this method to see if it worked with my dynamic content but it did not.

I set a Div with a Dynamic Content Provider value of {{dc:looper:field key="_drts_location_address"}} and created a Text object set to Consumer with this in the text field {{dc:looper:field key="display_address"}}. This resulted in nothing displayed.

Hey @santosfel5,

Would you mind sharing your admin credentials so that we can check your setup properly? To do that, please give us the following information in a Secure Note.

  • WordPress Login URL
  • Admin level username and password

You can find the Secure Note button at the bottom of your posts.

Thank you.

All set! This info has been provided.

Hello @santosfel5,

In your Looper Provider Dynamic Content, you should be using this: {{dc:post:meta key="_drts_location_address"}}.

Screen Shot 2022-06-23 at 10.22.31 AM

And then you can use the {{dc:looper:field key=“display_address”}} dynamic content in your Looper Consumer’s Text element to display the display address.

Best Regards.

Thank you! That worked.

Hey @santosfel5,

You’re welcome! If you have any other concerns or clarifications regarding our theme features, feel free to open up a new thread.

Thank you.