For loops in MB Blocks with MB Builder

Support MB Blocks For loops in MB Blocks with MB BuilderResolved

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #15615
    josesotelojosesotelo
    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.

    #15621
    Anh TranAnh 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
    josesotelojosesotelo
    Participant

    Hello!

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

    Thanks.

    #15636
    Anh TranAnh 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
    josesotelojosesotelo
    Participant

    Awesome! thank you very much

    #15673
    Anh TranAnh Tran
    Keymaster

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

    #15900
    josesotelojosesotelo
    Participant

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

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