mardi 2 août 2016

ACF - get checkbox values inside flexible content field

Have been going around and around with this and can't make it work - probably something very simple but I've got no hair left - can anyone help me?

<?php
if( have_rows('page_content') ):
while ( have_rows('page_content') ) : the_row();

    if( get_row_layout() == 'specs' ):

        // check if the nested repeater field has rows of data
        if( get_sub_field('objectives') ):
        echo '<ul>';
        $field = get_field_object('objectives');
        $value = $field['value'];
        $choices = $field['choices'];

            // loop through the rows of data
            foreach( $value as $v):
                echo '<li>'.$choices.'</li>';

            endforeach;
            echo '</ul>';
        endif;
    endif;
endwhile;
endif;
?>

Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire