Home Forums General Issues Options page field values not showing on page load


Options page field values not showing on page load

  • Hi all, the fields I’m putting in my footer.php are coming up blank on page load. I can’t see anything I’ve done wrong. In the process of debugging I’ve made the functions.php code as simple as possible:

    if( function_exists('acf_add_options_page') ) {

    I’ve then set up three simple text fields:

    And called them in the footer.php code:

    <div class="section center">
          <h1 class="fadein"><?php the_field('get_in_touch'); ?> <br/>
            <div class="underline"></div>
          <h2 class="fadein">
                  <?php if( get_field('tell_me_about_your_project') ): ?>
                    <?php the_field('tell_me_about_your_project'); ?>
                  <?php endif; ?></h2>
          <div class="fadein">
            <a class="more" data-toggle="modal" data-target="#emailMe">
                <?php the_field('talk_to_me'); ?>

    Unfortunately the fields just don’t seem to do anything on the actual page. I’ve tried changing them from their default values, but that doesn’t change anything either unfortunately. Any pointers?

  • Functopus,

    When retrieving values from an option page, you have to put ‘option’ as the second parameter in the get_field() and/or the_field() functions.

    So for your first field, you would use:

    the_field('get_in_touch', 'option');

    You can learn more about this in the documentation:

    Look at the template usage section

  • Amazing, thanks. Should have caught that myself really. I’m still feeling dopey from the festival I was at over the weekend – really appreciate the help.

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

The topic ‘Options page field values not showing on page load’ is closed to new replies.