Home Forums Front-end Issues Show the values of a field on the front end in a list


Show the values of a field on the front end in a list

  • Hi All 🙂

    I am a beginner to this and am after adding the values of some of the fields I have created for Woocommerce products on the front end in a custom information tab.

    I have created the addition info tab in the functions.php file.

    Now, to get the info I need into this tab.

    I can show a field in the field set by using the following

    echo the_field('location');

    But, I want to do these as

    • etc like this

      So, how to I insert html into the echo?


      echo '<li>Location Title : the_field('location')</li>';

      So, on the front end would be

    • Location Title : location
    • trying all sorts here and dont have the time to go back to school and learn the basics of PHP LOL


  • Figured it out 🙂

    echo '<p>acf stuff' . get_field('location') . '</p>';

    Now – how to hide this line, if no value, or a specific value is saved for this field?

  • A simple check should do:

    $location = get_field('location');
    if($location) :
        echo '<p>acf stuff' . $location . '</p>';
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.