Support

Account

Home Forums General Issues strtolower / str_replace

Solved

strtolower / str_replace

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

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘strtolower / str_replace’ is closed to new replies.