Is there a trick to passing a the_sub_field value through one of these functions? I am using both but neither one of them seem to be working.
Example:
<h2 id=”<?= strtolower(str_replace(array(‘ ‘, ‘:’), array(‘-‘, ”), the_sub_field(‘section_name’))); ?>”><?= the_sub_field(‘section_name’); ?></h2>
the_sub_field()
as with the_field()
echos the value of a field rather than return it. You need to use get_sub_field()
which returns a values so that you can do something with it.