ACF Archives is a little plugin for helping you attach ACF fields to the archive template.
The plugin will add a submenu for each public custom post type with archive defined
and then you can select under ACF rules box.
Here is a code example you can add to to your theme functions.php
add_filter( 'acf_archive_post_types', 'change_acf_archive_cpt' );
function change_acf_archive_cpt( $cpts ) {
// 'book' and 'movie' are the cpt key.
// Remove cpt
unset( $cpts['book'] );
// Add cpt
$cpts['movie'] = Movies Archive;
return $cpts;
}
$object = get_queried_object();
$field = get_field( 'field_name', $object->name );
var_dump( $field );
acf-archive
folder to the /wp-content/plugins/
directory