Support

Account

Home Forums Front-end Issues Can't display fields value with the_field()

Solved

Can't display fields value with the_field()

  • I have 4 custom fields: date, topic, place, and state. I want to display value of these fields in my front-page.php (home). But it’s not display anything.

    I followed some tutorials. Since I’m just a beginner programmer, I don’t really know the problem.

    Here is my code:

    <table>
      <tr><th colspan="4">ISO Training</th></tr>
      <tr> <th>Date</th> <th>Topic</th> <th>Place</th> <th>State</th> </tr>
      <?php while(have_posts()) : the_post(); ?>
          <tr>
            <td width="8%"><?php echo the_field('date'); ?></td>
            <td width="50%"><?php echo the_field('topic'); ?></td>
            <td width="25%"><?php echo the_field('place'); ?></td>
            <td width="17%"><?php echo the_field('state'); ?></td>
          </tr>
      <?php endwhile; ?>
    </table>
  • Probably its not correct query (while…). Does it shows for example the_title(); ? Maybe the problem is not with acf 🙂

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

You must be logged in to reply to this topic.