Hello,
Thanks for the feedback!
The generated Post Type Archive post id can be used in any ACF function or logic that is compatible with a $post_id
argument. This includes:
For example, if your Post Type Archive post id is my-post-type_archive
, then you can use it like that:
$get_field = get_field('my_field', 'my-post-type_archive');
$get_fields = get_fields('my-post-type_archive');
$have_rows = have_rows('my-post-type_archive');
If you prefer to use have_archive(): the_archive()
, then get_fields()
will work out of the box, just like get_field()
. Usage example:
if(have_archive()):
while(have_archive()): the_archive();
// get all fields from the archive
$get_fields = get_fields();
endwhile;
endif;
You’ll find more information about the generated Post Type Archive post id and how to loop over values in the documentation here.
Hope it helps!
Have a nice day!
Regards.