Make ACF flexible content item name accesible and enable using directives inside php functions

ACF flexible content is great for page-builders. Each item in flexible content can be used as a standalone section that can be input into different pages. It’s nice because you can make a template for each section and name that template the same as you name ACF flexible content item - so that you can loop through all the flexible content items you’ve added and include the template inside the loop based on item name.

If I want to use sage to do it, I have to use php loop and inside that loop - sage layout loop - in which I go through all the items just to get to item currently selected by php loop. Which is reduntand. It works and all, but it would surely be good to be able to have access to the name of layout that is currently pointed by the @layouts loop. Something like in pic included


This topic was automatically closed after 42 days. New replies are no longer allowed.