# Select Image
The Select Image field offers the ability to populate a drop-down field with an array of images names. When selected, a preview of the image appears underneath.
Table of Contents
# Arguments
Name | Type | Default | Description |
---|---|---|---|
type | string | select_image | Value identifying the field type. |
options | array | Array of arrays in the following format:
| |
default | string | Full URL of the default image. | |
placeholder | string | Select an item | Text to display in the selector when no value is present. |
Also See
# Build Config
Build a Custom Configuration →
Changes you make to this form will be reflected in the generated code.
Redux::set_field( 'OPT_NAME', 'SECTION_ID', array(
'type' => 'select'
) );
# Example Config
Redux::set_field( 'OPT_NAME', 'SECTION_ID', array(
'id' => 'opt-select-image',
'type' => 'select_image',
'title' => esc_html__('Select Image', 'your-textdomain-here'),
'subtitle' => esc_html__('A preview of the selected image will appear underneath the select box.', 'your-textdomain-here'),
'desc' => esc_html__('This is the description field, again good for additional info.', 'your-textdomain-here'),
'options' => array(
array (
'alt' => 'Image Name 1',
'img' => $url_to_img_1,
),
array (
'alt' => 'Image Name 2',
'img' => $url_to_img_2,
)
),
'default' => $url_to_img_1,
) );
# Example Usage
This example is based on the example usage provided above. Be sure to change $redux_demo
to the value you specified in your opt_name argument.
global $redux_demo;
echo '' . $redux_demo['opt-select-image'];