Is this your exact code? If it is then you have an extra opening php tag that appears before your first endif. There is no closing php tag on the code that precedes this. I’m not sure if this would cause it, but it would cause something to go wrong.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
ACF PRO’s Flexible Content field allows you to create smaller pieces of UI and compose them into whole flexible patterns. In our latest article, we show how to use it to create swappable site sections and integrate it all in a theme.https://t.co/ZRocH8oJSp