BACK TO DIRECTORY

Advanced Custom Fields: Archive Templates

by Imark Image

5.0
(2 ratings)

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.

Want to add or remove the submenu for other custom post types?

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;
    }

Get the acf field on archive page

    $object = get_queried_object();
    $field = get_field( 'field_name', $object->name );

    var_dump( $field );

From within WordPress

  1. Visit ‘Plugins > Add New’
  2. Search for ‘acf archive’
  3. Activate ACF Archive from your Plugins page.

Manually

  1. Upload the acf-archive folder to the /wp-content/plugins/ directory
  2. Activate the ACF Archive plugin through the ‘Plugins’ menu in WordPress

Screenshots

New Archive ACF rule under ACF rules

New Archive ACF rule under ACF rules

ACF Archive menu page under each custom post type with archive enabled.

ACF Archive menu page under each custom post type with archive enabled.

Plugin Details

Active Installs
800
Total Downloads
13,093
Version
1.0.6
Requires WP
4.1
Requires PHP
5.4
Tested Up To
5.4.21
Added
2018-10-25
Last Updated
2020-05-25 6:54pm GMT

Ratings

5
2
4
0
3
0
2
0
1
0