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.
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’re hard at work on ACF 6.1, and Beta 1 is now available 🚀— Advanced Custom Fields (@wp_acf) March 16, 2023
This release includes custom post type and taxonomy registration, an improved experience when selecting field types, PHP 8.1 and 8.2 compatibility, and more!
Let’s take a look 🧵https://t.co/Y0WcAT11l4
© 2023 Advanced Custom Fields.