Support

Account

Home Forums Front-end Issues Displaying fields from a cloned group inside a group Reply To: Displaying fields from a cloned group inside a group

  • Hi,

    first there seems to be a wrong declaration of the vars in your code:

    <?php 
    //vars
    $event = get_field('events');
    $event = get_field('address'); // should be $address ?

    Then if you want to get the cloned fields, you simply call it by field name to get an array of subfields OR by using the prefix for each field (see your settings screenshot => you enabled this option):

    $location = get_field('location');
    <div id="address" itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
    		<strong>Address: </strong><span itemprop="streetAddress"><?php echo $location['street_address']; ?></span>, <span itemprop="addressLocality"> <?php echo $location['city']; ?></span>, <span itemprop="addressRegion"><?php echo $location['state']; ?></span>, <span itemprop="addressCountry"><?php echo $location['country']; ?></span>
    	</div>

    Example for getting seperate subfields:

    
    $location_street_address = get_field('location_street_address');
    $location_city = get_field('location_city');
    $location_state = get_field('location_state');
    $location_country = get_field('location_country');
    
    <div id="address" itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
    		<strong>Address: </strong><span itemprop="streetAddress"><?php echo $location_street_address; ?></span>, <span itemprop="addressLocality"> <?php echo $location_city; ?></span>, <span itemprop="addressRegion"><?php echo $location_state; ?></span>, <span itemprop="addressCountry"><?php echo $location_country; ?></span>
    	</div>