Help Center
Displaying Icon from the Repeater Field Using the Dynamic Data Addon

Displaying Icon from the Repeater Field Using the Dynamic Data Addon

Learn how to use the widgets, such as Tabs, Classic Accordion, Slider, etc., of the JetElements or JetTabs plugins to set a custom icon right from the Iconpicker field of the Repeater meta field.

Before you start, check the tutorial requirements:

Create an Iconpicker Field Within the Repeater Meta Field

Navigate to the WordPress Dashboard > JetEngine > Meta Boxes or WordPress Dashboard > JetEngine > Post Types (depending on the “Repeater” meta field location). For instance, we intend to add the “Repeater” meta field to the “Popular Tours” Custom Post Type (CPT).

In this case, we typed the “Days” text into the Label field, and the Name field was automatically filled with the “days” text. Here, the Repeater meta field will include two “Text” and two “Iconpicker” fields (the “Active Icon” field for the active widget and the “Icon” field 一 for the unrolled widget).

repeater with the inserted field

Once you are done, hit the “Update Post Type” button to save the changes.

Fill the Repeater Fields With Icons

The next thing you need to do is to set the icons for each post. 

Open the CPT post you need, scroll down to your meta box, and find the “Repeater” meta field. For each Repeater item, set the desired icons. Update the post.

In this case, we opened the “Wonderful Poland” post of the “Popular Tours” CPT, inserted data into the “Day” and “Description” fields, and then selected the icons for the “Active icon” and “Icon” fields. Finally, we saved the changes.

adding icons to the iconpicker fields

Place the Widget

Open the previously created Single Post Template for this CPT. Customize the page as needed.

Find the Classic Accordion or any other widget that supports Dynamic data addon and add it to the page. Then, open the widget settings and expand the Dynamic Settings tab.

Read more about the widget’s settings in the How to Use Accordion Layout to Display Content in Tabs tutorial.

First, enable the Enable dynamic data toggle. After that, set the following settings in the newly-appeared fields.

Leave the “Post Meta” option in the Source drop-down list selected and add the “Repeater” meta field’s name in the Repeater field name field (here, we typed the “days” text). 

Then, if you have two icons (one for the active widget and the second one ― for the unrolled widget), type the “yes” text in the Active (yes or empty string) field; otherwise, leave this field empty.

After that, insert the names of these fields into the Icon and Active Icon fields (the “icon” and “active-icon” values, respectively).

Things to know

You can keep the Icon and Active Icon fields empty to display no icons via the widget. Also, you can use a macro to display the custom icons in the Icon and Active Icon fields. In particular, insert the “iconpicker_field|render_fa_icon” macro text, where the “iconpicker_field” part stands for the name of the “Iconpicker” field. For example, if the name of our first “Iconpicker” field is “icon,” insert the following “icon|render_fa_icon” value.

In the last step, fill out the Label field 一 here, we inserted the name of the “Day” meta field (in particular, the “day” text). 

Type the “editor” text in the Content type (editor or template) field. Next, insert the name of the meta field that includes the data to be displayed in the active widget into the Editor Content field (the “description” text in this case).

Finally, press the “Publish” button.

dynamic settings of the classic accordion widget

Navigate to the front end to observe if the widget works correctly.

mobile render tab settings of the jetmenu plugin

That’s it. Now you know how to display custom icons from the “Repeater” meta fields in the Accordion widget with the JetEngine and JetTabs plugins for WordPress.

Was this article helpful?
YesNo

Need help?

Ask Facebook community

Get answers from 22K Crocoblock Community experts from all over the world.

Start a live chat

Ask question to support agent and share its details via chat messages.