Count Gutenberg blocks on the front-end?
-
Working on my 3rd project using Gutenberg blocks and have a requirement where I need to count the blocks in the loop so I can create, dynamically, a ‘jump to’ menu to various blocks, whatever order they are set as in the post/page.
I can count posts, ACF repeater fields etc in a loop – but is there a similar way to count the blocks, so I can set a conditional ‘If block 2, do x… if block 5 do this… etc’
Thanks in advance.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Count Gutenberg blocks on the front-end?’ is closed to new replies.