So let’s say I am creating an Accordion inside a template.
The plan is to set the amount of accordion elements and the accordion content itself via ACF on individual page/post basis (similar to ACF’s repeater functionality).
Is this possible?
How do I need to set this up inside the template?
I just want to get a general idea so I can adopt to everything else.
Thanks for the hint, I am aware of that.
I am looking for a solution to control it per page/post basis.
The actual accordion is part of a template which is assigned to the page/post.
So it’s rather dynamic blocks than dynamic content I guess.
Did you happen to see the part that I timestamped?
They have the accordion inside a repeater, and the repeater queries an ACF repeater set for the page. That way you can dynamically control the number of items on each page via an ACF repeater.
The accordion is not part of the page.
It is part of the template which is assigned to the page.
I want to control the number of accordion items and the accordion content itself from the page, not the template.
I might trying to achieve something with the complete wrong approach tough.
@Marius Currently, you can’t build your repeaters template, if there isn’t any content inside the actual repeater. (so as a result this won’t work in the site editor)
A not elegant workaround (not dynamic) but with the same outcome, is to simply prebuild the custom fields for the maximum number of accordions you will have and afterwards map them to the accordions titles & content inside the template.
I don’t know if it was reported before. And I don’t know if it’s a bug or if there is a condition in the code that prevents to build the repeater if there isn’t content for it. (in a way it makes sense to work this way)
Thank you @alex. I’m really curious about it. Why did this not come up until now?
Can you share some thoughts about this topic, whenever you have a free minute @Louis?