Support Forum
Hello friends, i have created an image select custom field, to display 1 of 2 logos on my post. I am having trouble displaying the PNG.
this is my code to display:
<?php $value = rwmb_meta( 'wordpress_builder_select', ['value' => 'Image URL'] ); ?>
<?= $value ?>
I feel like everything is set correctly within metabox and wordpress but my output isn't right. Can anyone help?
my error on the frontend: https://dropover.cloud/91a209
METABOX code:
<?php
add_filter( 'rwmb_meta_boxes', 'Web Builder' );
function Web Builder( $meta_boxes ) {
$prefix = '';
$meta_boxes[] = [
'title' => __( 'Social Proof', 'Ruben' ),
'id' => 'social-proof',
'post_types' => ['social-proof'],
'fields' => [
[
'name' => __( 'Quote', 'Ruben' ),
'id' => $prefix . 'text_ulop3uxguxa',
'type' => 'textarea',
],
[
'name' => __( 'Type of Website', 'Ruben' ),
'id' => $prefix . 'type_of_website',
'type' => 'text',
],
[
'name' => __( 'Wordpress Builder Select', 'Ruben' ),
'id' => $prefix . 'wordpress_builder_select',
'type' => 'image_select',
'options' => [
'bd' => __( 'https://buildingabetter.website/wp-content/uploads/2023/02/brakedance_logo.png', 'Ruben' ),
'o' => __( 'https://buildingabetter.website/wp-content/uploads/2023/02/oxygenlogo.png', 'Ruben' ),
],
],
],
];
return $meta_boxes;
}
Hello,
Please follow the documentation to know how to output the image_select
field
https://docs.metabox.io/fields/image-select/
For example: rwmb_meta( 'wordpress_builder_select' );
And please notice that, this field saves the value, not the image URL. If you want to output the image with URL, please use the helper function rwmb_the_value().
For example: rwmb_the_value( 'wordpress_builder_select' );