There are many post types on this site. My script will put the data from any post type. I have the standard posts and pages and in this project I also created a CPT for “products” and another for “projects” The script is designed to pull information from any post type.
There are 2 field groups. One field group is used for setting a “featured post” and one field group is used for setting up “related posts”. These two field groups are mixed and matched on the various post types and page templates. For example on the blog the client can select only “related posts” but on a project they can also select a “featured post”, and when I say post that means of any post type.
In this part of the script
'change [data-key="field_59d246273950f"] .acf-input select': 'featured_post_change', 'change [data-key="field_59d242a16ff63"] .acf-input select': 'related_post_change',
the first field key is the field key of the post object field for the featured post. The second is the field key of the post object field that is inside the repeater used to select related posts.
The other field keys all relate to the other fields in each of the field groups so they are all different depending on if I’m populating the fields in the repeater vs the fields that are not in the repeater.
I’m attaching the field groups in an export if that will help.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.