Now is your last chance to buy a lifetime license before we switch to annual pricing. Existing licenses will be unaffected.
read more
Posted on February 24, 2024

Import Details for Each Meta Box Custom Field Type

hello world!

To understand the process of importing data into Meta Box custom fields, please see A Complete Guide to Importing Data from Meta Box Custom Fields.

In this article, we describe what should be imported for each custom field type.

Table of Contents

Meta Box offers six distinct field types, each consisting of multiple fields. The field types are:

Meta Box Basic Fields

  • Text: Simple, plain-text field.
  • Textarea: Same as the text field, except that it provides a more extensive writing area.
  • Checkbox: This lets you import a single checkbox field.
  • Checkbox List: This lets you import multiple choices. When using Set with XPath, you have to separate multiple choices with commas. If you have both values and labels in your field definition, use the values.
  • Radio: A list of radio inputs where you can select a single choice from a predefined list.
  • Select: A simple select dropdown for one or multiple values. When using Set with XPath, you have to separate multiple values with commas. If you have both values and labels in your field definition, use the values.

For more information, see How to Import Meta Box Basic Fields.

Meta Box WordPress Fields

  • Post: Links with a post type or custom post type. You can import with post ID, slug, or title. Make sure to separate multiple entries with the separator character.
  • Sidebar: Imports a sidebar from the site.
  • Taxonomy: Links with a taxonomy from the site and sets post terms.
  • Taxonomy Advanced: Links with a taxonomy from the site and stores term IDs.
  • User: Links with a user from the site.

To learn more, see How to Import Meta Box WordPress Fields.

Meta Box Upload Fields

  • File: Single file upload.
  • File Advanced: Multiple file upload.
  • File Input: Simple text input for uploading a single file.
  • File Upload: Upload area that you can drag and drop or select files to upload. 
  • Image: Single image upload. Doesn't use the Media Library UI to upload images.
  • Image Advanced: Multiple image upload.
  • Image Upload: Inline upload area that you can drag and drop or select images to upload.
  • Single Image: Select or upload one image via the WordPress media library.
  • Video: Video field.

For more information, see How to Import Meta Box Upload Fields.

Meta Box HTML5 Fields

  • Email: Simple plain-text field for an email.
  • Number: Simple plain-text field for a number.
  • Range: Simple plain-text field to import the number range.
  • URL: Simple plain-text field to import a URL.

To learn more, see How to Import Meta Box HTML5 Fields.

Meta Box Advanced Fields

  • Autocomplete: Simple plain-text field with autocomplete features. When using Set with XPath, separate multiple choices with commas. If you have both values and labels in your field definition, use the values.
  • Background: This lets you set the background color, select an image, and set other background settings.
  • Color Picker: The field allows you to select a color. You can specify the hex code for the color preceded with a #, e.g., #ea5f1a.
  • Date Picker: This field stores a date. Use any format supported by the PHP strtotime() function.
  • Datetime Picker: This field stores a date and a time. Use any format supported by the PHP strtotime() function.
  • Fieldset Text: The field can contain a set of text inputs. It's useful when saving related information. You can import into each text input separately.
  • Hidden: This field is a simple hidden input. It's used to store custom data that cannot be changed.
  • Image Select: This field lets you select a choice visually with images. It works similarly to the radio/checkbox fields but with images. When using Set with XPath, separate multiple choices with commas. If you have both values and labels in your field definition, use the values.
  • Key Value: This field lets you enter an unlimited group of "key-value" pairs. You can choose FixedVariable (XML), or Variable (CSV). The interface lets you define these fields.
  • oEmbed: This field creates a simple text input to import a media URL and display that media.
  • Password: This is a simple password input. 
  • Select Advanced: This field creates a select dropdown using the select2 library. When using Set with XPath, separate multiple choices with commas. If you have both values and labels in your field definition, use the values.
  • jQuery UI Slider: This field is a slider where you can select a number by dragging a control.
  • Switch: The switch field shows an on/off switch for you to enable/disable something. When using Set with XPath, you can import 1 for on and 0 for off.
  • Text List: The text list field is a list of text inputs. You'll have fields to import each available text input.
  • Time Picker: This field allows you to select a time. Use any format supported by the PHP strtotime() function.
  • WYSIWYG Editor: Typical What-You-See-Is-What-You-Get field, which allows adding most content types to it.

For more information, see How to Import Meta Box Advanced Fields.

Meta Box Cloneable & Repeatable Fields

Meta Box doesn't have a specific cloneable or repeatable field. Instead, you can turn every field type into a cloneable or repeatable field type by enabling its Cloneable feature:

Enable Cloneable Fields in Meta Box

You'll then see some additional options. To learn more about this feature, see Cloning fields.

The first thing to remember when importing data into these fields is that repeatable data should be stored in the same column/record in your import file.

Second, there are three different modes for importing cloneable data, as follows:

Mode 1: Fixed

Use Fixed when each piece of the incoming data is stored in separate elements or columns. For example, if you have a repeater field containing an image, and your CSV file has five columns – image_1, image_2, image_3, etc:

Fixed Cloneable Data Example

To handle this, manually add five rows in the cloneable field by clicking + Add more:

Fixed Cloneable Field Add more

Once you have the correct number of fields, drag and drop each image to its corresponding row, i.e., image_1 to the first row, image_2 to the second row, and so on.

Mode 2: Variable (XML)

Use this option if your Meta Box cloneable data is stored as “sibling” elements in XML format:

<images>
<image>image_example_1.jpg</image>

<image>image_example_2.jpg</image>
<image>image_example_3.jpg</image>
<image>image_example_4.jpg</image>
<image>image_example_5.jpg</image>
</images>

Drag & drop won’t create the correct XPath expression when using Variable (XML) mode. Instead, you need to modify your XPath expressions using WP All Import's FOREACH syntax:

Variable XML Cloneable Field Meta Box

Mode 3: Variable (CSV)

Use this option if your Meta Box field data is stored in a single column and separated by a separator character.

For example, if your Meta Box cloneable field contains a list of ingredients (Name and Measure – i.e., 1/2 cup is the measure and butter is the name), and the names & measures are stored in separate columns inside your CSV file:

Variable CSV Cloneable Field Meta Box

Since commas have been used to separate this cloneable data, change the Separator Character from a pipe character to a comma. Then, drag & drop the name and measure columns into their appropriate sub-fields in the Meta Box cloneable field. The result should look like this:

Map Variable CSV Cloneable Field Meta Box

When the Meta Box cloneable data is imported, the first item in the name column will be associated with the first item in the measure column, the second item in the name column with the second in the measure column, and so on.

To learn more, see How to Import Meta Box Cloneable & Repeater Fields.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get Oxygen Today

Lifetime, unlimited site license

Copyright © 2024 Soflyy
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram