Hello themeco,
I’ve encountered a critical bug with nested loopers in Cornerstone where the first iteration (index 0) of a child looper is consistently skipped on the frontend for the penultimate post in the parent looper, accompanied by a PHP error.
Environment:
- Pro Theme/Cornerstone: 6.7.11
- WordPress: 6.9
- Caching: FlyingPress
Looper Structure:
- Grid (Looper Provider: Custom Post Type “cursussen”)
└─ Cell (Looper Consumer)
└─ Div (Looper Provider: {{dc:acf:post_field field=“cursusdata_jaar”}})
└─ Text (Looper Consumer displaying year)
└─ Div (Looper Provider: {{dc:looper:field key=“cursus_data”}})
└─ Text (displaying dates)
The Bug:
- Works perfectly in Cornerstone builder - all data displays for all posts
- On frontend: For the penultimate post (second-to-last) in the parent looper:
- Only index 1 of “cursusdata_jaar” renders
- Index 0 is completely skipped (not in HTML source)
- Using {{dc:looper:debug_consumer}} confirms only index 1 exists on frontend
- All other posts (including the last post) work correctly
- When I duplicate the problematic post, it works fine, but then the new penultimate post exhibits the same bug
PHP Error in error_log: Got error ‘PHP message: PHP Warning: Attempt to read property “ID” on null in /home/xxx/domains/xxxxxx/public_html/wp-content/themes/pro/cornerstone/includes/classes/Services/FrontEnd.php on line 201’, referer: https://sanopharm.com/cornerstone/edit/38937
Debug Findings:
- {{dc:looper:count}} returns correct count (2) in both builder and frontend
- Cache clearing has no effect
- The issue is in the rendering phase, not data retrieval
- The $post global appears to be null during nested looper execution for the penultimate item
Any idea why this is happening?
Many thanks in advance!
Dagaloni
