How to Display Images from Cloneable Fields - P4 - with Bricks
Tags: tutorial, cloneablefields, customfields, brandlogo
Published: 2023-01-03 03:01:47

Continuing <a href="https://metabox.io/series/display-images-from-cloneable-fields">the series</a> of displaying images from cloneable fields, today we’ll use **Meta Box** and another page builder - **Bricks**.

<!--more-->
Take the brand logos as an example:

<img alt="Example of displaying images from cloneable fields" height="567" src="https://i.imgur.com/mNQGqbR.png" width="1000">

## Video Version

https://youtu.be/UZ-8JEEUNyc

## Before Getting Started

Typically, we’ll use a custom post type to create multiple posts for brands. But now, I’ll do another way more conveniently and simply - creating a settings page. All brand information will be input onto that page. It means that all of them will be in one place only.

<img alt="All brand information is put into the settings page" height="535" src="https://i.imgur.com/lQaXxjJ.png" width="1000">

For this practice, we need these tools:

* <a href="https://wordpress.org/plugins/meta-box/">Meta Box core plugin</a>: to have the framework for creating custom fields. It’s free, so you can download it directly from <a href="https://wordpress.org/plugins/mb-custom-post-type/">wordpress.org</a>;
* <a href="https://metabox.io/plugins/mb-settings-page/">Meta Box Settings Page</a>: to create settings pages to input images;
* <a href="https://metabox.io/plugins/meta-box-builder/">Meta Box Builder</a>: to have an intuitive UI to create custom fields in the backend;
* <a href="https://metabox.io/plugins/meta-box-group/">Meta Box Group</a>: to organize custom fields into cloneable groups, where we input images.
* **Bricks**: to build the page

## Create a Settings Page

Go to **Meta Box &gt; Settings Page &gt; Add New.**

In my case, the settings page is quite simple and contains only the image of each brand. As there’s no special setting, I'll just change the option name.

<img alt="Create a settings page" height="463" src="https://i.imgur.com/Vvrql4e.png" width="1000">

After publishing, you’ll see a new settings page named **Brands** appears as below:

<img alt="Created settings page appears in the menu dashboard" height="484" src="https://i.imgur.com/S1Z1BuW.png" width="1002">

It’s blank now.

## Create Custom Fields

Let’s create custom fields for the settings page. They will be used to save the brand information.

In the admin dashboard, go to **Meta Box &gt; Custom Fields &gt; Add New**. I created fields with the structure below.

<table>
<thead>
<tr>
<th>**Field**</th>
<th>**Types of Field**</th>
<th>**ID**</th>
</tr>
</thead>
<tbody>
<tr>
<td>Brand Group</td>
<td>Group</td>
<td>brand_group</td>
</tr>
<tr>
<td>Brand Logo Upload</td>
<td>Single Image</td>
<td>brand_logo_upload</td>
</tr>
<tr>
<td>Brand Name</td>
<td>Text</td>
<td>brand_name</td>
</tr>
</tbody>
</table>

This is a group with 2 subfields inside. It is also set to be cloneable to have more spaces to add information for different brands.

<img alt="Set the created fields to be cloneable" height="701" src="https://i.imgur.com/oVFMAGs.png" width="1000">

After that, go to the **Settings** tab and choose the **Location** as the settings page that we’ve created to apply the custom fields to it.

<img alt="Set location for the created fields" height="586" src="https://i.imgur.com/q8eWRPv.png" width="1000">

Back to the settings page, and you’ll see the created custom fields appear. Moreover, to add another brand’s information, you can press the **Add more** button.

<img alt="Add more button to add another brand's information" height="563" src="https://i.imgur.com/1e8AcPK.gif" width="1000">

Now, just fill in the brand’s information in the fields.

## Display Images on the Frontend

Let’s edit a page with **Bricks**. I chose the homepage for example.

First, to contain all the brands' information, add a new section. Then, put it in any place where you want to show it on that page.

Next, to add the title of the section, choose the **Heading** element and name it.

<img alt="Choose the heading element to add the title of the section" height="565" src="https://i.imgur.com/EJrofNF.png" width="1000">

In the **Container** element inside the section, select the **Div** element to contain the brand information.

<img alt="Add a Div a element in the Contain element to contain the brand information" height="564" src="https://i.imgur.com/Pxty2ap.png" width="1000">

Then, to get the data of brands, enable the **Use query loop** button. And in the **Query** section, choose the type of data source as **MB Group: Brand Group**. In the name, you can see the ‘Brand Group’ is the name of the group that we’ve just created.

<img alt="Choose the type of data source as MB Group" height="519" src="https://i.imgur.com/8uOrwqN.png" width="1004">

For the brand’s logos, as they are saved in the custom field created by Meta Box, choose the **Image** element &gt; choose the **Select Dynamic data** button &gt; select the right field - Brand Image Upload. Now all the brand's logos are displayed already.

<img alt="All the brand's logos are already displayed" height="563" src="https://i.imgur.com/q0VM7gp.gif" width="1000">

For the brand’s names, choose the **Basic Text** element. We also use the **Select Dynamic data** button and choose the field correspondingly. Then, you’ll see the brand’s name displayed immediately.

<img alt="Choose the Basic text element and use the Select Dynamic data button then choose the field correspondingly" height="563" src="https://i.imgur.com/4sd3DoR.gif" width="1000">

On the homepage, you’ll see all of the brand information.

<img alt="All the brand information is displayed on the homepage" height="799" src="https://i.imgur.com/HlGt615.png" width="1000">

## Style the Section

Now, go back to the page editor with **Bricks**, choose each element and change the settings to style them in your own way.

After styling, all the brand logos are displayed as we want.

<img alt="Style the Section" height="567" src="https://i.imgur.com/mNQGqbR.png" width="1000">

## Last Words

Is it so easy to display the images from cloneable fields with Meta Box and Bricks without coding, right?

Remember to follow our channel and share your result in the comment section!

---The publication at [Meta Box](https://metabox.io/display-images-from-cloneable-fields-p4-bricks/)---