Support

Home Forums Event Espresso Premium Events Table Question

Events Table Question

Posted: December 2, 2013 at 3:34 pm


B D

December 2, 2013 at 3:34 pm

I’m using the Events Table template. Instead of the venue, I would like to have in the table only the city. How to do this?

Thank you in advance.


Sidney Harrell

December 2, 2013 at 8:03 pm

In espresso_table.php use this to replace the sql starting on line 70:

if ($type == 'category'){
			$sql = "SELECT e.*, ev.city venue_city FROM " . EVENTS_CATEGORY_TABLE . " c ";
			$sql .= " JOIN " . EVENTS_CATEGORY_REL_TABLE . " r ON r.cat_id = c.id ";
			$sql .= " JOIN " . EVENTS_DETAIL_TABLE . " e ON e.id = r.event_id ";
			$sql .= " LEFT JOIN " . EVENTS_VENUE_REL_TABLE . " vr ON e.id = vr.event_id ";
			$sql .= " LEFT JOIN " . EVENTS_VENUE_TABLE . " ev ON ev.id = vr.venue_id";
			$sql .= " WHERE c.category_identifier = '" . $category_identifier . "' ";
			$sql .= " AND e.is_active = 'Y' ";
		}else{
			$sql = "SELECT e.*, ev.city venue_city FROM " . EVENTS_DETAIL_TABLE . " e ";
			$sql .= " LEFT JOIN " . EVENTS_VENUE_REL_TABLE . " vr ON e.id = vr.event_id ";
			$sql .= " LEFT JOIN " . EVENTS_VENUE_TABLE . " ev ON ev.id = vr.venue_id";
			$sql .= " WHERE e.is_active = 'Y' ";
		}

Of course, you’ll need to adjust the table header around line 136, and in the table body, down around 195, you’ll use the variable

$event->venue_city


B D

December 3, 2013 at 2:03 am

Thank you, but I’d like to ask where is the file espresso_table.php situated?


Dean

December 3, 2013 at 2:21 am

Hi,

It is in the custom files addon, so if that is installed it will be wp-content/uploads/espresso/templates/


B D

December 3, 2013 at 2:23 am

Thank you for the quick reply.

I don’t have custom files addon. Is it not possible to do this modification without the addon?


Dean

December 3, 2013 at 2:42 am

Hi,

Well the Events Table template is only available with the Custom Files addon, so I am not sure if we are referring to the same thing here.

Can you clarify the file name and where you got it from?


B D

December 3, 2013 at 2:52 am

I have it in the Custom Template addon, which I downloaded from my account. It is the default template.


Dean

December 3, 2013 at 3:23 am

Ah right that makes more sense now, thank you, I forgot that we renamed that template to Event Table.

The above code Sidney provided wont work as he too was under the assumption it was for the Custom Files addon, so please disregard that code.

The template you need is in:

wp-content/plugins/espresso-custom-templates/templates/events-table and it is the index.php file there.

I just added a basic templating guide for it here https://eventespresso.com/wiki/custom-templates-addon-create-a-template/ which may help you.

In asnwer to your original question it should be simple enough to change the Venue name on line 33 to City and then on line 98 change this:

<td id="venue_title-<?php echo $event->id?>" class="venue_title"><?php echo $event->venue_name ?></td>

to this:

<td id="venue_title-<?php echo $event->id?>" class="venue_title"><?php echo $event->venue_city ?></td>

Basically, if you do a var_dump of $events, you will get a whole list of the available values. I’ll look to compile something in the near future.


B D

December 3, 2013 at 4:05 am

Thank you Dean.

I may not have been specific enough. What is need is not only to change the label (from Venue to City), but to have in the table itself only the name of the city (and not the whole venue).

I have changed as you suggested but nothing shows in the City field (former Venue) in the table. Also before making this changement the venue didn’t show up, although it was filled in the events’ data.


Dean

December 3, 2013 at 4:27 am

Hi,

The venue data should really be filled out via the Venue Manager (if it is not in your Event Espresso menu go to General Settings and set “use benue Manager” to Yes). When a Venue is created and then allocated to the event the details will show up in the table.

This is a small example – http://d.pr/i/aFNx – the first event has a venue set and the second one doesn’t.


B D

December 3, 2013 at 5:35 am

Thank you, it is working fine now. (The venue data was not filled via the Venue Manager.)

But the above change in the index.php will be overriden with the next updates, won’t it? How to do to keep the change?


Dean

December 3, 2013 at 6:03 am

Hi,

Check out the tutorial I linked to, you can create a new template based on the one you are using and place it somewhere outside of the plugin such as uploads or your theme.

Here’s the link again https://eventespresso.com/wiki/custom-templates-addon-create-a-template/


B D

December 3, 2013 at 6:38 am

Thank you.


Dean

December 3, 2013 at 6:40 am

You’re welcome!

The support post ‘Events Table Question’ 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