Let Users See All Events at a Location By Clicking Location Name
This is something we needed to do for our site, since many of our users' events will frequently be at the same locations. It's not a perfect solution by any means, but it works for us.
Caveats:
The file you need to edit is /includes/events/template-tags.php. Because this is in a sub directory, you cannot just edit this file and throw it in a child theme (it won't be loaded). So you have to edit the file in the parent Vantage theme. Make sure you make a note of your edits and keep a copy of it on your computer backed up so when you update Vantage you can redo your edits if your changes got overwritten.
So in template-tags.php, look for the
function get_the_event_address which is about line 3.
On or around line 11, you should see:
PHP Code:
if ( !empty( $location ) ) {
if ( !empty( $location_url ) ) {
$html .= html(some code here I had to delete because this forum did not like me having so many urls in my post);
} else {
$html .= html( 'div', array( 'class' => 'location' ), $location );
}
}
Replace this with:
PHP Code:
if ( !empty( $location ) ) {
if ( !empty( $location_url ) ) {
$html .= html( 'div', array( 'class' => 'location location link' ), html( 'a', array( 'href' => esc_url( 'http://' . $location_url ), 'target' => '_blank' ), 'View the Website For ' . $location ), html ('br'), html( 'a', array( 'href' => esc_url( get_site_url() . '/?st=event&ls=' . urlencode($location) . '&location='), 'target' => '_blank' ), 'See All Events At ' . $location));
} else {
$html .= html( 'div', array( 'class' => 'location location link' ), html( 'a', array( 'href' => esc_url( get_site_url() . '/?st=event&ls=' . urlencode($location) . '&location='), 'target' => '_blank' ), 'See All Events At ' . $location) );
}
}
This will do two things:
If the user provided a URL for the website of the location, it will spit out something that looks like:
View the Website For Location Name Here < links to location's website the user provided when creating the
See All Events At Location Name Here < links to Vantages built-in search function for Events, with "Location Name" as the search string
So if they click View the Website, it will take them to the website in a new window. If they click See All Events, it will open a search for the location name in a new window.
If the user didn't provide a website url, just the location name, then it will simply spit out:
See All Events At Location Name Here
This will be spit out on both the single event page, and in the event list on your homepage, event categories, etc.
Hopefully this helps some people who want this functionality! I don't know much about making plugins, but I'll look into maybe seeing if I can learn how to make this a plugin for Vantage.