02 May 2021

ACF Link in repeater field


<?php if( have_rows('call_to_actions') ): ?>
<?php while( have_rows('call_to_actions') ): the_row();
?>
<?php
$link = get_sub_field('button');
if( $link ):
$link_url = $link['url'];
$link_title = $link['title'];
$link_target = $link['target'] ? $link['target'] : '_self';
?>
<div class="btn-wrap">
<a class="btn btn-primary scoli-primary-btn" href="<?php echo esc_url( $link_url ); ?>" target="<?php echo esc_attr( $link_target ); ?>"><?php echo esc_html( $link_title ); ?> <i class="material-icons">arrow_forward</i></a>
</div>
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>