Support

Account

Home Forums Add-ons Repeater Field How to display radio button options? Reply To: How to display radio button options?

  • Hello. I also have a radio button sub field type within a repeater field.
    Here is my code:

    <?php if( have_rows('outcomes_your_activity_seeks') ): ?>
                
                    <?php while( have_rows('outcomes_your_activity_seeks') ): the_row(); 
                        // variables
                        $radio_1 = get_sub_field('radio_1');
    		    $radio_2 = get_sub_field('radio_2');
    		    $radio_3 = get_sub_field('radio_3');
                        $radio_4 = get_sub_field('radio_4');
    		?>
    		
    		<p class=""><?php echo $radio_1; ?></p>
                    <p class=""><?php echo $radio_2; ?></p>
    
                    <?php endwhile; ?>
                
                <?php endif; ?>

    As I have a few of these custom field setups, is there way to code a loop that displays all sub fields based on the ‘Order’ ‘Label’ ‘Name’ ‘Type’ as opposed to having to put in each unique sub field name? This would prevent a lot of manual coding.

    Also I don’t understand the different between get_sub_field and the_sub_field? One returns a value and the other displays – how are they different?

    My website users are filling out the custom fields form in the WordPress Dashboard. All I need to do is display the content from the form in the front of the website.

    Hoping there is a quick way to display the label + values of the choice/text/select/ sub fields?