Loop counter

Community Forums Forums General Discussion Loop counter

This topic is: not resolved


This topic contains 2 replies, has 2 voices, and was last updated by  damienoh 2 years, 3 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #53677


    I am currently testing the Genesis Framework v2.0 RC2. I found that the $loop_counter is missing from the genesis_standard_loop() when using HTML5. is this by design?

    I have issues inserting content in between posts between the $loop_counter is no longer working.

    Anyone having this problem?


    David Chu

    An interesting question. The answer does indeed appear to be “yes”. There is a genesis_standard_loop function in 2.0. If HTML5 is not in effect, it performs genesis_legacy_loop instead, which contains the counter and the old hooks. No counter in the standard loop. It doesn’t say why it’s gone in the comments; I’m guessing that maybe they viewed it as not heavily used?

    So it looks like you’ll need to code your way around that, unfortunately. I can see where that counter could be occasionally useful – off the top of my head, I’m thinking I would pull out the normal loop, and replace with a custom loop with a counter.


    Dave Chu ยท Custom WordPress Developer – likes collaborating with Designers



    If I edit the core files, I just have to add in three lines of code: global $loop_counter;, $loop_counter = 0; and $loop_counter++;, but that mean I can’t just update the core files OTA.

    Replacing with a custom loop with a counter is a good solution, but I think it is a waste of resources.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.