Home › Forums › General Issues › how get subfiled value array get_option(); instead ACF field ? › Reply To: how get subfiled value array get_option(); instead ACF field ?
yeah !
<?php $numbers = get_option('options_' .'numbers', true);
if ($numbers) {
for ($i=0; $i < $numbers; $i++) {
$num = 'numbers_'.$i.'_num';
$tel = get_option('options_' . $num, true);
$tel_preg = preg_replace('/[^\d+]/', '', $tel ); ?>
<a href="te:<?php echo $tel_preg;?>" class="phone">
<?php echo $tel; ?>
</a>
<?php }
} ?>
instead
<?php if ( have_rows( 'numbers', 'options' ) ) : ?>
<?php while ( have_rows( 'numbers', 'options' ) ) :
the_row(); ?>
<?php if ( $num = get_sub_field( 'num', 'options' ) ) : ?>
<?php echo esc_html( $num ); ?>
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.