Hi, I've been trying to get a Google map to display in the front end, it looks fine in the custom meta but when I try to output I get nothing, no errors, nothing.
this is how I set up the field in the custom meta file:
// Venue Postcode
array(
'name' => esc_html__( 'Venue Postcode' ),
'id' => "leisure_venue_postcode",
'desc' => esc_html__( 'Venue Postcode' ),
'type' => 'text',
//'readonly' => true,
),
array(
'id' => 'leisure_venue_location',
'name' => __( 'Venue Location' ),
'type' => 'map',
// Default location: 'latitude,longitude[,zoom]' (zoom is optional)
'std' => '50.2270734,-5.2778787,17',
// Name of text field where address is entered. Can be list of text fields, separated by commas (for ex. city, state)
'address_field' => 'leisure_venue_postcode',
),
Then I output the map in a template file using the following code:
$args = array(
'type' => 'map',
'width' => '100%', // Map width, default is 640px. Can be '%' or 'px'
'height' => '480px', // Map height, default is 480px. Can be '%' or 'px'
'zoom' => 14, // Map zoom, default is the value set in admin, and if it's omitted - 14
'marker' => true, // Display marker? Default is 'true',
'marker_title' => '', // Marker title when hover
'info_window' => '<h3>Info Window Title</h3>Info window content. HTML <strong>allowed</strong>', // Info window content, can be anything. HTML allowed.
);
print rwmb_meta( 'leisure_venue_location', $args ); // For current post
I used this page as a reference: https://github.com/rilwis/meta-box/blob/master/demo/map.php
and this: https://metabox.io/docs/display-map-in-the-front-end/
all the other meta in the page is displaying fine with no issues.