Posted: 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. |
|
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 |
|
Thank you, but I’d like to ask where is the file espresso_table.php situated? |
|
Hi, It is in the custom files addon, so if that is installed it will be wp-content/uploads/espresso/templates/ |
|
Thank you for the quick reply. I don’t have custom files addon. Is it not possible to do this modification without the addon? |
|
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? |
|
I have it in the Custom Template addon, which I downloaded from my account. It is the default template. |
|
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. |
|
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. |
|
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. |
|
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? |
|
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/ |
|
Thank you. |
|
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.