Post Type Archive

ACF Extended adds a new location which create an Archive Options Page for any custom post type. Field groups can be displayed after the title, after the list or in the sidebar.

In order to use this Field Group Location, you must enable the “Archive Page” setting in the Post Type UI. See Dynamic Post Types documentation.

Fields Values

Fields values are saved using a custom post ID based on the post type name: {post_type_name}_archive.

You can retrieve fields values using the common get_field() function. Usage example:

// Post Type: My Post Type
$textarea = get_field('textarea', 'my-post-type_archive');

Fields Values Loop

It is possible to access the Post Type Archive fields values in the front-end without having to set the custom Post ID, using the have_archive(): the_archive() loop. Usage example:

/*
 * Template: 'archive-my-post-type.php' or 'single-my-post-type.php'
 */
if(have_archive()):
    while(have_archive()): the_archive();
    
        // Get field value
        $textarea = get_field('textarea');
    
    endwhile();
endif;
/*
 * Template: Anywhere
 */
if(have_archive('my-post-type')):
    while(have_archive('my-post-type')): the_archive();
    
        // Get field value
        $textarea = get_field('textarea');
    
    endwhile();
endif;