Reputation: 263
So I working on a wordpress site with the FoundationPress Theme and I recently upgraded ACF to the Pro version which allows for the repeater field. So I'm trying to allow the client to add new social media accounts with the repeater.
https://i.sstatic.net/h4Boh.jpg
https://i.sstatic.net/kTq9p.jpg
Above you can see how the repeater is set up on the backend.
Header.php:
<div class="medium-3 columns">
<?php
if (have_rows('social_media')):
while(have_rows('social_media')):the_row();
$link = get_sub_field('social_media_link'); ?>
<a href="<?php echo $link; ?>" />
<?php endwhile;
endif;
?>
</div>
Nothing is outputted into the HTML.
Let me know if I left out any information
Upvotes: 0
Views: 716
Reputation: 6412
The options page requires an additional value in the field code (see https://www.advancedcustomfields.com/resources/get-values-from-an-options-page/).
<div class="medium-3 columns">
<?php
if (have_rows('social_media', 'option')):
while(have_rows('social_media', 'option')):the_row();
$link = get_sub_field('social_media_link'); ?>
<a href="<?php echo $link; ?>" />
<?php endwhile;
endif;
?>
</div>
Upvotes: 1