API + ACF combination

Hi,

How can we combine data from an API with content added on the site before displaying posts on the front-end? Probably we can use ACF custom post type with the set of respective fields for that. Is there a way to store data received / updated through API into ACF custom post fields?

There’s isn’t a way entirely using the UI. With the Twig Advanced Extension you can call arbitrary functions like update_field. I would only try this on a staging site first and I would probably opt to just display API data if you can. This has come up a number of times to the point we’ll eventually have a video going through this, although it won’t be for the faint of heart. Ideally we would have an “Action” system in Cornerstone, but we probably won’t tackle that till we start handling forms. Let us know if this helps.

{{ function('update_field', 'my_field', looper.item.apiValue, post.id) }}

Thanks, @charlie.

I appreciate that and will test that out. Did I get you right that Themeco has plans to do that in a more straight forward way in future? That would be nice to have that in PRO’s tool set at least. As always I am looking forward to your updates.

1 Like

When we handle forms we will have a similar “Action” system yes to what you are trying to do. We’re a bit far away from that, but I’ll keep ideas like updating an ACF field in mind when we tackle that. Have a great day.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.