I’ve created a cpt and I’ve used acf to attach fields to it.
I’m creating a loop to get publish the cpt’s. Within my loop neither ‘the_field()’ nor ‘echo the_field() are returning values.
What do I need to do in order to print the values from my fields?
This is what my loop looks like:
In this loop, values are returned as expected for the_title and get_permalink.
<?php while ($jobs_query->have_posts()) : $jobs_query->the_post(); ?>
<h3 class=”job-title”><?php the_title() ?></h3>
<?php echo the_field(‘job_description’) ?>
<p class=”job-readmore”>“>read more</p>
<?php endwhile; ?>
the_field() echos, get_field() returns. Use either
However, that aside, there’s nothing in the code you’ve supplied that indicates what could be wrong.
the_title() outputting the correct post title?
The only two conclusions I can reach based on the code above is that the field name is not “job_description” or the field has no value.