I received this request on the WordPress.org forum:
Is there a way to assign a link to the “location” field? I’d like to list all events for a specific production on a page and have the “location” field linkable to the theatre address.
By default your events look something like this:

Now add the following code to your (child)theme’s functions.php file:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Adds a new 'Venue URL' field to the event editor. | |
* | |
* @param array $fields The current fields of the event editor. | |
* @return array The new fields of the event editor. | |
*/ | |
function wpt_event_editor_add_venue_url_field($fields) { | |
$new_fields = array(); | |
foreach($fields as $field) { | |
$new_fields[] = $field; | |
if ('venue' == $field['id']) { | |
$new_fields[] = array( | |
'id' => 'venue_url', | |
'title' => 'Venue URL', | |
'edit' => array( | |
'placeholder' => 'http://', | |
), | |
); | |
} | |
} | |
return $new_fields; | |
} | |
add_filter( 'wpt/event_editor/fields', 'wpt_event_editor_add_venue_url_field'); | |
/** | |
* Adds a link to the venue HTML if the venue URL is set. | |
* | |
* @param string $html The current venue HTML. | |
* @param WPT_Event $event The event. | |
* @return string The new venue HTML. | |
*/ | |
function wpt_event_add_venue_url($html, $event) { | |
$venue_url = $event->custom('venue_url'); | |
if (!empty($venue_url)) { | |
$html = '<a href="'.esc_attr($venue_url).'" target="_blank" style="display: block;">'.$html.'</a>'; | |
} | |
return $html; | |
} | |
add_filter( 'wpt_event_location_html', 'wpt_event_add_venue_url', 10, 2); |
The first parts adds a new ‘Venue URL’ field to the event editor:
The second part of the code wraps the HTML output of an event location with a link to the venue URL:
