Support Forum
Hi Support,
I have two custom field types Single Image and OSM Map on a standard WP Post. These work well on the backend - (1) users can upload an image and (2) set an address for the map to display - respectively,
However, the map does not display on the same post when the Single Image is also shown. When I remove the Single Image display block, then the OSM map starts to display.
Theme used for testing is Twenty Two Theme. I am using MB Views (shortcode method) to display these elements. No other pagebuilders or Gutenberg blocks are involved.
If you need it, I can provide such access for you to verify the scenario.
Kind regards,
Here's the MB Views code:
{{ mb.map( 'post.osm_id', '100%', '480px', '10' ) }}
Kind regards,
Hi,
I do not see that issue on my demo site, here is a screen record https://monosnap.com/file/PBiqcNxALbX1XKrZktWg5bZ5tSqoHD
Can you please share the code that creates the custom fields and View code that outputs the field value on your site?
Thanks for the Video, Long. In my scenario, the image and map custom fields are shown in separate views. Here's the requested code:
Custom Field - Single Image
<?php
add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' );
function your_prefix_function_name( $meta_boxes ) {
$prefix = '';
$meta_boxes[] = [
'title' => __( 'Post PIN', 'your-text-domain' ),
'id' => 'post-pin',
'context' => 'side',
'fields' => [
[
'name' => __( 'Title Pin', 'your-text-domain' ),
'id' => $prefix . 'single_image_5x4mtt49jj',
'type' => 'single_image',
],
],
];
return $meta_boxes;
}
Custom Field - Text and Map
<?php
add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' );
function your_prefix_function_name( $meta_boxes ) {
$prefix = '';
$meta_boxes[] = [
'title' => __( 'Location and Map', 'your-text-domain' ),
'id' => 'location-and-map',
'context' => 'side',
'fields' => [
[
'name' => __( 'Enter Country, Region, or City', 'your-text-domain' ),
'id' => $prefix . 'text_8sy68td8rn7',
'type' => 'text',
],
[
'name' => __( 'Zoom Level', 'your-text-domain' ),
'id' => $prefix . 'osm_v4fb8cliwlo',
'type' => 'osm',
'address_field' => 'text_8sy68td8rn7',
'language' => 'en',
'region' => 'in',
],
],
];
return $meta_boxes;
}
View - Image
<img src="{{ post.single_image_5x4mtt49jj.full.url }}" width="{{ post.single_image_5x4mtt49jj.full.width }}" height="{{ post.single_image_5x4mtt49jj.full.height }}" alt="{{ post.single_image_5x4mtt49jj.full.alt }}">
View - Map
{{ mb.map( 'post.osm_v4fb8cliwlo', '100%', '480px', '14' ) }}
Thank you and look forward to your advise to resolve this.
Kind regards,
PS: Here's a screenshot to illustrate the problem further.
Kind regards,
Hi,
Please share your site credentials via this contact form https://metabox.io/contact/
I will take a closer look.
Thanks for your support, Long. I have shared the details, as requested.
Kind regards,
Hi,
Thanks for sharing the info. I'm able to reproduce the issue on my demo site and I've escalated this issue to the development team to fix it in the next update. Meanwhile, you can add the shortcode to display the image first and the shortcode to display the map after. Screenshot https://monosnap.com/file/8JJpmHDaqk7viAFyIurbJKPqtVLDp8
Thank you for the confirmation, Long. Appreciate your support.
I cannot change the order of the elements (image first and map second) because it won't fit into the article's flow.
Any ETA on the fix?
Kind regards,
Hi,
Is this resolved now?
Kind regards,
Not yet, the development team is working on this issue. I will let you know when it is fixed.
Thanks and eagerly looking forward to an update on this one!
Hello,
Can you please update MB Views 1.11.4 or Meta Box AIO 1.16.7 to the latest version to fix this issue?
Let me know how it goes.
Yes, MB Views 1.11.4 does the trick. It's fixed.
Thanks MB and Peter.
Kind regards,