• Hello,
    my loop will be something like this
    -set tabnumber to 0

    [loop field=city value='{VALUE}']
    [if first]<div class="tab-[field value=tabnumber+1]">[-loop field=city value='{VALUE}']<li>...</li><li>...</li><li>...</li>[/-loop]</div>[/if]
    [/loop]

    I need to have an incremental number for each loop. I need this because results will go in a tabbed view and I need different number for each tab.
    Does your plugin already support incremental numbers? I could find only random number in reference.
    Thank you!

    https://www.ads-software.com/plugins/custom-content-shortcode/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Eliot Akira

    (@miyarakira)

    Hello,

    There’s a shortcode called [loop-count] which outputs the current index of the loop. Could you try and see if that can be used?

    Such a simple thing and so very handy for numbering the tabs from another plugin, but I never could find a shortcode to do this before. Thanks so much for this tip!

    Plugin Author Eliot Akira

    (@miyarakira)

    I added a note about [loop-count] in the documentation.

    There’s another shortcode that might be of interest, which I haven’t documented yet.

    [x 10]
      {X}
    [/x]

    The [x] shortcode just loops for the number of times specified. Inside, {X} will display the current index. I usually use it for testing purpose, to create a hundred loops for example. ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Incremental numbers in loop’ is closed to new replies.