I'm developing a WordPress theme and I need some expert advice to achieve a little complex result. My theme has a custom post type and that post type should have child items. For example the post is about a software and every time a new version is released, I need to update the post and add the new version info (URL, version number, file size etc.). Can this be achieved using meta data (custom fields) or is there some better way? Please guide me in a right direction.
I'm developing a WordPress theme and I need some expert advice to achieve a little complex result. My theme has a custom post type and that post type should have child items. For example the post is about a software and every time a new version is released, I need to update the post and add the new version info (URL, version number, file size etc.). Can this be achieved using meta data (custom fields) or is there some better way? Please guide me in a right direction.
You should be able to do this fairly easily with the save_post hook. When one of the child pages is saved your hook will fire and allow you to firstly check the post type, and then if the post is indeed a child of your main post, where you want to update the URL, version etc.
You can retrieve the child post values using ACF get_field:
$latest_version = get_field('software_version', $post->ID);
Then update your parent using the ACF update_field:
update_field('current_version', $latest_version, $post->post_parent);
Un-tested, but that gives you the basics.