Item number within a group

Support MB Group Item number within a groupResolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #19478
    James PirretJames Pirret
    Participant

    Hi

    I am trying to get a number value for each group, so that thee first one is 1, then 2, etc. is there a way to call this, I seem to only be able to call 1 for all of them.

    Thanks in advance.

    #19486
    Long NguyenLong Nguyen
    Moderator

    Hi James,

    Do you mean auto-increment value of the field number when using a cloneable group? Please describe more about the question.

    #19491
    James PirretJames Pirret
    Participant

    Hi Long,

    Sure, sorry, I'll try to be clearer. I have a cloneable group and for each group I would like to either call or assign it a number so that each group is numbered 1, 2, 3, etc.

    The aim is to be able to use php queries to be able to assign alternating classes and also if needed I can identify specific numbers if required.

    I hope that makes more sense.

    #19494
    Long NguyenLong Nguyen
    Moderator

    Hi James,

    When you get the value of the cloneable group with rwmb_meta(), it returns an array with the key is indexed from 0, so you can use this key to numbered the group. For more information, please follow the documentation
    https://docs.metabox.io/extensions/meta-box-group/#getting-sub-field-value
    https://www.php.net/manual/en/language.types.array.php

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.