Custom Fields
Re-Envisioned
Support MB Blocks For loops in MB Blocks with MB Builder

This topic contains 6 replies, has 2 voices, and was last updated by  josesotelo 1 month, 3 weeks ago.

  • Creator
    Topic
  • #15615
    Resolved
    josesotelo
    Participant

    I want to create a for loop to render a clonable text field in order to create LIs.

    <ul id="pros-list">
       {% for i in pros %}
          <li>{{i}}</li>
       {% endfor %}
    </ul>

    That’s based on the example in Twig, but I realize that it won’t get the array in my custom field called “pros” because it isn’t between brackets, the issue is that if I add {{pros}} inside any kind of {% %} it crashes WP.

    Also, I want to do a math equation with the fields, something like ({{a}} + {{b}})/2, how can I achieve that?

    Thanks in advance!

    Cheers.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Author
    Replies
  • #15621

    Anh Tran
    Keymaster

    Hi Jose,

    For math, please use {{ (a + b) / 2 }}.

    Regarding the cloneable fields, let me try it and will get back to you soon.

    #15623

    josesotelo
    Participant

    Hello!

    The math worked, so I’m looking forward to your feedback regarding the clonable fields.

    Thanks.

    #15636

    Anh Tran
    Keymaster

    After debugging, I found a JS bug that doesn’t collect correct values from cloneable/group fields. I’ll fix it and update the plugin as soon as I can.

    #15642

    josesotelo
    Participant

    Awesome! thank you very much

    #15673

    Anh Tran
    Keymaster

    This bug is fixed in version 1.0.3. New version for AIO will come a little later.

    #15900

    josesotelo
    Participant

    Awesome! just tried it out and works like a charm.

Viewing 6 replies - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.