Results 1 to 1 of 1

Thread: Let Users See All Events at a Location By Clicking Location Name

  1. #1
    Thread Starter
    Expired Customer nrsworld's Avatar
    Join Date
    Oct 2014
    United States
    Thanked 0 Times in 0 Posts

    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.


    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_urlget_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_urlget_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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Location search results show wrong location and country
    By mr9sky in forum Report JobRoller Bugs
    Replies: 4
    Last Post: October 12th, 2014, 05:10 PM
  2. Mapsupreme Set Coordinates To Users Location
    By delawarecreative in forum Mapsupreme
    Replies: 1
    Last Post: February 17th, 2014, 09:21 PM
  3. Move location of contact/poster/location on individual ad area
    By trick in forum ClassiPress General Discussion
    Replies: 5
    Last Post: June 18th, 2011, 08:25 AM
  4. Replies: 20
    Last Post: May 10th, 2011, 03:48 AM