Support Forum
Hello, I have a basic WordPress install. All plugins other than metabox have been disabled.
When using the Images Select option from Custom Fields only one image shows (last one).
I set debug to true and no errors are showing.
Thank you
Hi,
Thank you for reaching out.
Can you please share the code that creates the field image_select? I will help you to check this issue.
<?php
add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' );
function your_prefix_function_name( $meta_boxes ) {
$prefix = '';
$meta_boxes[] = [
'title' => __( 'Property Details', 'your-text-domain' ),
'id' => 'property-details',
'post_types' => ['property'],
'fields' => [
[
'name' => __( 'Images', 'your-text-domain' ),
'id' => $prefix . 'images',
'type' => 'image_upload',
],
[
'name' => __( 'Property Price', 'your-text-domain' ),
'id' => $prefix . 'property_price',
'type' => 'number',
'admin_columns' => [
'position' => 'after title',
'title' => 'Price $',
'sort' => true,
],
'columns' => 6,
],
[
'name' => __( 'Full Address', 'your-text-domain' ),
'id' => $prefix . 'full_address',
'type' => 'text',
],
[
'name' => __( 'Address', 'your-text-domain' ),
'id' => $prefix . 'address',
'type' => 'text',
'placeholder' => __( 'Street Number and Name Only', 'your-text-domain' ),
'columns' => 10,
],
[
'name' => __( 'City', 'your-text-domain' ),
'id' => $prefix . 'city',
'type' => 'text',
'columns' => 10,
],
[
'name' => __( 'Postal Code', 'your-text-domain' ),
'id' => $prefix . 'postal_code',
'type' => 'text',
'columns' => 7,
],
[
'name' => __( 'Built', 'your-text-domain' ),
'id' => $prefix . 'built',
'type' => 'text',
'columns' => 6,
],
[
'name' => __( 'Square Footage', 'your-text-domain' ),
'id' => $prefix . 'square_footage',
'type' => 'text',
'placeholder' => __( 'Numbers only (2500)', 'your-text-domain' ),
],
[
'name' => __( 'Lot Size', 'your-text-domain' ),
'id' => $prefix . 'lot_size',
'type' => 'text',
],
[
'name' => __( 'Open House Day', 'your-text-domain' ),
'id' => $prefix . 'open_house_day',
'type' => 'date',
],
[
'name' => __( 'Open House Start Time', 'your-text-domain' ),
'id' => $prefix . 'open_house_start_time',
'type' => 'time',
],
[
'name' => __( 'Open House End Time', 'your-text-domain' ),
'id' => $prefix . 'open_house_end_time',
'type' => 'time',
],
[
'name' => __( 'Floors', 'your-text-domain' ),
'id' => $prefix . 'floors',
'type' => 'radio',
'options' => [
1 => __( '1', 'your-text-domain' ),
2 => __( '2', 'your-text-domain' ),
3 => __( '3', 'your-text-domain' ),
4 => __( '4', 'your-text-domain' ),
],
],
[
'name' => __( 'Bedrooms', 'your-text-domain' ),
'id' => $prefix . 'bedrooms',
'type' => 'radio',
'options' => [
__( '0', 'your-text-domain' ),
__( '1', 'your-text-domain' ),
__( '2', 'your-text-domain' ),
__( '3', 'your-text-domain' ),
__( '4', 'your-text-domain' ),
__( '5', 'your-text-domain' ),
__( '6', 'your-text-domain' ),
],
'std' => 2,
],
[
'name' => __( 'Bathrooms', 'your-text-domain' ),
'id' => $prefix . 'bathrooms',
'type' => 'radio',
'options' => [
0 => __( '0', 'your-text-domain' ),
1 => __( '1', 'your-text-domain' ),
'1.5' => __( '1.5', 'your-text-domain' ),
2 => __( '2', 'your-text-domain' ),
'2.5' => __( '2.5', 'your-text-domain' ),
3 => __( '3', 'your-text-domain' ),
'3.5' => __( '3.5', 'your-text-domain' ),
4 => __( '4', 'your-text-domain' ),
'4.5' => __( '4.5', 'your-text-domain' ),
5 => __( '5', 'your-text-domain' ),
'5.5' => __( '5.5', 'your-text-domain' ),
6 => __( '6', 'your-text-domain' ),
'6.5' => __( '6.5', 'your-text-domain' ),
],
],
[
'name' => __( 'Garage', 'your-text-domain' ),
'id' => $prefix . 'garage',
'type' => 'radio',
'options' => [
1 => __( '1', 'your-text-domain' ),
2 => __( '2', 'your-text-domain' ),
3 => __( '3', 'your-text-domain' ),
4 => __( '4', 'your-text-domain' ),
5 => __( '5', 'your-text-domain' ),
6 => __( '6', 'your-text-domain' ),
],
],
[
'name' => __( 'Parking', 'your-text-domain' ),
'id' => $prefix . 'parking',
'type' => 'radio',
'options' => [
1 => __( '1', 'your-text-domain' ),
2 => __( '2', 'your-text-domain' ),
3 => __( '3', 'your-text-domain' ),
4 => __( '4', 'your-text-domain' ),
5 => __( '5', 'your-text-domain' ),
6 => __( '6', 'your-text-domain' ),
],
],
[
'type' => 'divider',
],
[
'name' => __( 'Image Select', 'your-text-domain' ),
'id' => $prefix . 'image_select',
'type' => 'image_select',
'options' => [
'http' => __( '//zentyx.ca/realestate400/wp-content/uploads/2021/04/46H-scaled.jpg', 'your-text-domain' ),
],
],
[
'name' => __( 'Floor Plan', 'your-text-domain' ),
'id' => $prefix . 'floor_plan',
'type' => 'image_upload',
'max_status' => false,
],
[
'name' => __( 'Video Upload', 'your-text-domain' ),
'id' => $prefix . 'video_upload',
'type' => 'video',
'max_file_uploads' => 1,
],
[
'name' => __( 'Video Embed', 'your-text-domain' ),
'id' => $prefix . 'video_embed',
'type' => 'oembed',
'label_description' => __( 'Paste a link', 'your-text-domain' ),
],
[
'name' => __( 'Street Maps', 'your-text-domain' ),
'id' => $prefix . 'street_maps',
'type' => 'osm',
'address_field' => 'full_address',
'language' => 'en',
'region' => 'ca',
],
[
'name' => __( 'YouTube Video', 'your-text-domain' ),
'id' => $prefix . 'youtube_video',
'type' => 'text',
],
],
];
return $meta_boxes;
}
I'ts showing 1 image
Hi,
So we can see in the code, there is only one option to select one image. You can create more options (images) to select.
[
'name' => __( 'Image Select', 'your-text-domain' ),
'id' => $prefix . 'image_select',
'type' => 'image_select',
'options' => [
'http' => __( '//zentyx.ca/realestate400/wp-content/uploads/2021/04/46H-scaled.jpg', 'your-text-domain' ),
'http2' => __( '//zentyx.ca/realestate400/wp-content/uploads/2021/04/46H-scaled.jpg', 'your-text-domain' ),
],
],
Get more details in the documentation https://docs.metabox.io/fields/image-select/
How and where does this get entered?
From the interface I have 2 images selected. Why is this not working? Do we always have to add code to make these options work?
Hi,
If you are using the Builder, please add the option follow the format
value: image URL
value2: image URL 2
value3: image URL 3
See my screen record https://share.getcloudapp.com/mXupK1yn
Thank you.