Support

Account

Home Forums General Issues Code Example for more fields

Solved

Code Example for more fields

  • Hi,

    im using your great Plugin.

    I`ve created a few fields. Do you have a general code example for this situation.

    Now im using this code:
    <?php

    $values = get_field(‘field_name’);
    if($values)
    {
    echo ‘

      ‘;

      foreach($values as $value)
      {
      echo ‘

    • ‘ . $value . ‘
    • ‘;
      }

      echo ‘

    ‘;
    }

    // always good to see exactly what you are working with
    var_dump($values);

    ?>

  • There is extensive documentation for ACF here http://www.advancedcustomfields.com/resources/ that includes general code examples for all of the functions in ACF.

    The value returned by get_field('field_name') is generally a single value that was entered by the user or could be something else depending on the field type and what you’ve set it to return. You’ll need to give more specifics about the field, how it’s set up and what it is you’re trying to do or display.

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

The topic ‘Code Example for more fields’ is closed to new replies.