Support

Home Forums Event Espresso Premium how to replace venue name with venue city in event table?

how to replace venue name with venue city in event table?

Posted: January 24, 2019 at 7:21 am


Porter

January 24, 2019 at 7:21 am

Do you have some code that I could use to include the venue city rather than the venue name in the event table?


Tony

  • Support Staff

January 24, 2019 at 9:12 am

Hi there,

We don’t have code for this, but its fairly easy to do.

You need to copy the default template from the add-on \eea-events-table-template\templates\espresso-events-table-template.template.php

Copy that template to the root directory of your theme (preferably a child theme).

In that location you can edit the template to your custom output, for the above you’d change line 47 to use ‘Location’ (or whatever you prefer) rather than ‘Venue’, for example:

<th class="th-group"><?php _e('Location','event_espresso'); ?></th>

Then a little lower you pull that value in, so say on line 87, add:

$venue_city = '';
// get first related venue and convert to CSV string
$venue = $event->venues(array('limit' => 1));
if (is_array($venue) && ! empty($venue)) {
    $venue = array_shift($venue);
    if ($venue instanceof EE_Venue) {
        $venue_city = $venue->city();
    }
}

Like so – https://monosnap.com/file/fXK6lU5OErMze297Cv9CQQCDkDG48M

Then around line 123 (it’ll change depending on the above) you’ll have:

<td class="venue_title event-<?php echo $post->ID; ?>"><?php espresso_venue_name( NULL, FALSE ); ?></td>

Change that to:

<td class="venue_title event-<?php echo $post->ID; ?>"><?php echo $venue_city; ?></td>

The support post ‘how to replace venue name with venue city in event table?’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso