How to modify Checkbox list labels and add custom data-attributes

Support General How to modify Checkbox list labels and add custom data-attributesResolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #29694
    MalakMalak
    Participant

    Hi There,

    I am using a custom field of type "Post". I am using it to hold multiple posts references.

    As a field type, I am using the Checkbox list.

    The problem that I am facing is that I do not know how can I modify option labels so that I can include other fields data. Right now post title is being shown with each box.

    My second question is that how can I add data-attributes to each list element.

    I am stuck, any help will be greatly appreciated. Thanks!

    #29699
    Long NguyenLong Nguyen
    Moderator

    Hi Ahsan,

    If you want to add something to the choice labels, please follow this documentation https://docs.metabox.io/filters/#rwmb_choice_label

    But there is no filter hook to add data attributes to each list element. You can create your own custom field type by following this documentation https://docs.metabox.io/custom-field-type/

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