If you have a look at the code attached, there is a nested repeater field within the main repeater on line 97, basically it populates a small table within the main repeater with contents.
This is what its trying to display (this page uses a WYSIWYG field for the table which is very slow in the backend): http://s19263.p574.sites.pressdns.com/short-term-leasing-6-18-months/
For some reason its not working. Can anyone see what I did wrong?
Any help would be great.
It appears that you tried uploading a file that is not allowed for some reason. When uploading files that contain code you generally need to put them in a .zip file first. Or You can include code in a post by clicking on the code button or putting backticks around the code. It’s generally easier to help when code is correctly included in your comment using the code tags.
Looking at the code you supplied, your nesting of repeater loops is wrong and I can’t really tell how to fix it in a short time. Here’s what I can see and point out.
On line 50 you have a repeater loop. This loop ends at line 64. In order to have a nested repeater loop it would need to be inside of this loop, it is not.
On line 68 you start a foreach loop on the results of the repeater loop. This is not a repeater loop, this is a loop on the array. The call to
the_row() is not appropriate in this loop. I cannot say what errors this is causing. You’re nested loop that your talking about is on 97 is inside of this foreach loop and not nested in the first repeater loop.
My suggestion would be to put the nested repeater loop inside the first repeater loop and add the ‘table_contents’ repeater content into a nested array element of the $rows array you are creating there. Then in your second loop to create a nested foreach loop for this array element. Also make sure you remove the call to
the_row() that should not be there.
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.