The Advanced Custom Fields extension provides infinite scroll and lazy load functionality for various field types for the Advanced Custom Fields plugin.

The extension allows you to access Advanced Custom Fields data for a page, post, custom post type, or taxonomy and return the results to Ajax Load More for infinite scrolling.


How It Works

The extension works by providing a connection point between core Ajax Load More and the following field types for Advanced Custom Fields:

Utilizing a library of custom WordPress hooks, filters, and queries, the extension can retrieve custom field data from a post and display the results via infinite scroll with Ajax Load More.


Shortcode Parameters

Use the following shortcode parameters to initiate the Advanced Custom Fields extension with Ajax Load More.

acfEnable compatibility with Advanced Custom Fields. (true/false) Default = ‘false’
acf_post_idThe ID of the current page/post. Default = $post->ID
acf_field_typeSelect the type of ACF field. (flexible | gallery | relationship | repeater)
acf_field_nameThe name of the ACF field.
acf_parent_field_nameThe name of the parent ACF field for accessing nested sub-field data in a Repeater or Flexible Content field.
Note: You can access sub-field data up to three levels deep.
acf_row_indexThe name of the parent ACF field for accessing nested sub-field data in a Repeater or Flexible Content field.
Note: You can access sub-field data up to three levels deep.
Example Shortcode[ajax_load_more acf="true" acf_field_type="repeater" acf_field_name="our_team"]

Accessing Nested Sub-Field Data

The ACF extension provides functionality for loading sub-field data of a Repeater or Flexible Content field with Ajax Load More.

To achieve this functionality, you’re required to pass the acf_parent_field_name and acf_row_index to the shortcode.

  • acf_parent_field_name: The name of the parent ACF field. This can be up to three levels deep by colon separating the names.
    e.g. acf_parent_field_name="parent_1:parent_field_2"
  • acf_row_index: The row index of the Repeater or Flexible Content field. This instructs Ajax Load More to look at the specific row in the array data to pluck the results.

For example, you have a Flexible Content field named page_content with a nested Repeater field named, our_team that has been added as the 2nd item.

Example Shortcode[ajax_load_more acf="true" acf_parent_field_name="page_content" acf_row_index="2" acf_field_type="repeater" acf_field_name="our_team"]

Note: When accessing sub-field data you must use get_sub_field (docs) in your Repeater Template.