Loop counter

Community Forums Forums General Discussion Loop counter

This topic is: not resolved

Tagged: 

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

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

    damienoh
    Participant
    Post count: 1

    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?

    #53755

    David Chu
    Participant
    Post count: 1186

    Hi,
    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.

    Cheers,
    Dave


    David Chu · Custom WordPress Developer – likes collaborating with Designers

    #53846

    damienoh
    Participant
    Post count: 1

    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.