Hi,
I’m a beginner regarding PHP. I need to display all the custom fields of all the post of a specific category.
Should I start by a loop? Actually, I just show custom fields of a specific post such as :
<h2><?php the_field( "title_event", 2280 ); ?></h2>
And I would like to show all the post of my category such as :
<h2><?php the_field( "title_event" ); ?></h2>
But it’s not working, it’s generate nothing.
Thank you
Kopa
Hi @kopa92
You will need to first load all the posts from that category using standard wp query
<?php
query_posts('cat=2');
while (have_posts()) : the_post();
// now for each post show you field
the_field ("title_event");
endwhile;
?>
I hope this helps.