Custom Fields
Re-Envisioned
Support Meta Box Group Item number within a group

  • Creator
    Topic
  • #19478
    Resolved James 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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #19486
    Long 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 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 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 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.