Meta Box
Support › MB Blocks › Cloneable group with MB BuilderResolved
Hi, i have a cloneable group with a cloneable singe_image field. I have no idea how to ouput it with mb blocks.
Is that even possible and if so how?
Hello I'm also intested in the way to clone a group of fields in mb blocks. I'm not sure if it is possible but it would be a great feature. Many thanks
Hello Anja With the last version of mb blocks it is possible to clone a group.
'fields' => [ [ 'id' => 'thumbs', 'type' => 'group', 'clone' => true, 'sort_clone' => true, 'fields' => [ [ 'name' => "Thumb", 'id' => 'thumb', 'type' => 'file_advanced' ], ], ], ],
Kind regards
Hi Anja,
In MB Builder, assuming you have something similar to this:
https://imgur.elightup.com/8xKDkzJ.png
And you have added a block to a post with the following content:
https://imgur.elightup.com/FhbHQHn.png
Then you can use this template code in the MB Builder to display the group:
{% set products = mb.mb_get_block_field( 'products' ) %} {% for product in products %} <h4>{{ product.product_title }}</h4> {% for image_id in product.product_images %} {% set image_url = mb.wp_get_attachment_url( image_id ) %} <img src="{{ image_url }}"> {% endfor %} {% endfor %}
https://imgur.elightup.com/kMIPGrv.png
Here is the result:
https://imgur.elightup.com/PaIXpG4.png
(sorry for big images)