Okay, I’m a bit further – I now get ‘Array’ in the body when I put it in my single-event.php:
<?php eo_get_template_part('event-meta','event-single');
$current_events_venue_id = eo_get_venue();
echo eo_get_venue_meta( $current_events_venue_id, '_venue_gmaps', $gmaps_url); ?>
And here’s the entirety of my additons to functions.php:
// Event Organiser
add_action('add_meta_boxes','eo_custom_add_metabox');
function eo_custom_add_metabox(){
add_meta_box('eo_custom_metabox','Extra Info', 'eo_custom_metabox_callback', 'event_page_venues', 'side', 'high');
}
function eo_custom_metabox_callback( $venue ){
//Metabox's innards:
$_venue_gmaps = eo_get_venue_meta($venue->term_id, '_venue_gmaps',true);
//Remember to use nonces!
wp_nonce_field('eo_custom_venue_meta_save', 'eo_custom_plugin_nonce_field' );
?>
<label> Gmaps Short URL:</label>
<i class="howto">https://goo.gl/maps/***</i>
<input type="text" name="eo_custom_venue_gmaps" value="<?php echo esc_attr($_venue_gmaps);?>" >
<?php
}
add_action ('eventorganiser_save_venue','eo_custom_save_venue_meta');
function eo_custom_save_venue_meta( $venue_id ){
//If our nonce isn't present just silently abort.
if( !isset( $_POST['eo_custom_plugin_nonce_field'] ) )
return;
//Check permissions
$tax = get_taxonomy( 'event-venue');
if ( !current_user_can( $tax->cap->edit_terms ) )
return;
//Check nonce
check_admin_referer( 'eo_custom_venue_meta_save', 'eo_custom_plugin_nonce_field' );
//Retrieve meta value(s)
$gmaps_url = $_POST['eo_custom_venue_gmaps'];
//Update venue meta
eo_update_venue_meta($venue_id, '_venue_gmaps', $gmaps_url);
return;
}