I am fairly new to WordPress development and ACF (so be kind!). I am trying to create an index page that loops over all of my posts and pulls in some of the custom fields for each of these posts. Let’s say it’s like a custom summary of each post that a user can click on to go to the full post.
Right now, I have the following code in my index.php page:
if ( have_posts() ) : while ( have_posts() ) : the_post();
get_template_part( 'content', get_post_format() );
And then I have this code (tidied up for brevity) in my content.php page:
<h1><?php the_field('typeName'); ?></h1>
<li><?php the_field('typeNumber'); ?></li>
<li><?php the_field('typeName'); ?></li>
<li><?php the_field('typeCategory'); ?></li>
What I can’t figure out is how to tell the content page to do display the value of these fields for each post. I feel like it’s something simple that I’m missing, but any help would be appreciated!
That’s actually all you should need to do. The only thing that might be a problem is the category field. Is this not working?
Hey John, thanks for your reply. I realized my issue was that the loop was only pulling in values from the index page rather than each individual post because I had my homepage set to a static page rather than the blog posts page.