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 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.