Support

Account

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

  • There isn’t any way that I know of to get all of the sub fields at once. There isn’t a get_sub_fields() function, although it has been requested before http://support.advancedcustomfields.com/forums/topic/get_sub_fields/

    You need to get or display each sub field.

    As far as the difference between get_ and the_, as you said. the_sub_field echoes the value, it does not return anything. Let’s say that a sub field contains a url.

    If you do this

    <a href="<?php 
        the_sub_field('link'); ?>"><?php  the_sub_field('link_text'); ?></a>

    then the url and the text will be output where they belong.

    If you instead tried this

    <a href="<?php 
        get_sub_field('link'); ?>"><?php  get_sub_field('link_text'); ?></a>

    both the link attribute and the text of the link would be blank.

    get_sub_field() is useful when you need to assign the value to a variable, usually because you need to do more with it than simply echo the value.