Home Forums Event Espresso Premium customising the grid view template.

customising the grid view template.

Posted: July 14, 2017 at 6:55 am


July 14, 2017 at 6:55 am


I would like to know if it’s possible to:

A) force the grid template to only show the first date/time when hovering over the event.
B) hide the events from the grid if they are past the second date/time

I had a look in the template and can see a function to do with the date/time but i dont know where to begin changing this to do what i want.

Lines 34 – 38 in the espresso-grid-template.template.php

$datetimes = EEM_Datetime::instance()->get_datetimes_for_event_ordered_by_start_time( $post->ID, $show_expired, false, 1 );

		$datetime = end( $datetimes );

		$startdate = date_i18n( $date_format . ' ' . $time_format, strtotime( $datetime->start_date_and_time('Y-m-d', 'H:i:s') ) );

We have some code that hides the events from the table view after the two sessions. I think someone on here might have posted a git hub link with the code in to do that.

I imagine it will involve creating my own copy of that template file and its matching php file (do they still come in pairs?) i just dont know what i need to edit/change to do what i want.

Any help is much appreciated. Thanks!



  • Support Staff

July 14, 2017 at 8:42 am

Hi PhilB,

This would most likely involve some significant coding to accomplish. One thing you could do is add a snippet like this one:

What that will do instead is if it’s past the date where you can register for the event, the event will not be displayed in the grid.


July 14, 2017 at 9:30 am

Hi Josh,

I was hoping you wouldnt say that!! Understood though, i wasnt sure if it was something that could be done with a hook/filter or template change.

Thanks for the quick response. I just checkout out that snippet and it looks to be the one we have in use to hide them from the table view. it didnt seem to be working though. Just created a new event to try it with and realised i had two parts on the page asking for the events. One wasnt showing and the other was a masonry grid built into the theme.

It’s a shame i can only include the one category on the category slug. Currently i am just replicating the shortcode for the grid.

[ESPRESSO_GRID_TEMPLATE category_slug="project-2" limit=15 show_expired="false"]
[ESPRESSO_GRID_TEMPLATE category_slug="project-3" limit=15 show_expired="false"]
[ESPRESSO_GRID_TEMPLATE category_slug="project-4" limit=15 show_expired="false"]

Is that the best way to achieve that at the moment? ultimately what i am trying to achieve is 2 pages, one with beginner events and one with the 3 ‘advanced’ events. I’m aware though that i’m going beyond the scope of support now though.

Thanks Josh,



  • Support Staff

July 14, 2017 at 4:26 pm

I just checkout out that snippet and it looks to be the one we have in use to hide them from the table view. it didnt seem to be working though.

Can you check to see if ticket sale end date is set to a date in the past? That other snippet checks the ticket sale end dates and if those are in the past, then it will not show the event.


July 17, 2017 at 2:59 am

Hi Josh,

Thanks for the reply, sorry i’ve been off over the weekend. I’ve just checked now and it seems it is working, the event i was testing with expired over the weekend so when i’ve checked this topic this morning and checked my page the event had disappeared. I changed the date and it has reappeared now.

I think the part where it didnt seem to be working was because i had 2 grids rendering. One from the EE grid template and one using my theme’s masonry grid. The masonry grid one was still showing, where as the EE grid template was giving me the default ‘we cant seem to find what youre looking for’. That was my mistake.

My only issue now is getting the grid to only display the first date/time for the event.

Because each event is split over 6 sessions we dont want to confuse users with the dates changing on front end each week.

Would that be the part that involves the heavy coding?

Thanks Josh,



  • Support Staff

July 17, 2017 at 6:30 am

So regardless of how many datetimes on the event you only want to show the first datetime details on hover, even if that datetime has expired?

Copy espresso-grid-template.template.php to your themes root directory.


$datetimes = EEM_Datetime::instance()->get_datetimes_for_event_ordered_by_start_time( $post->ID, $show_expired, false, 1 );


$datetimes = EEM_Datetime::instance()->get_datetimes_for_event_ordered_by_start_time( $post->ID, true, false, 1 );

That change tells get_datetimes_for_event_ordered_by_start_time() to include expired datetimes, it is set to return a single datetime so it will always be either the next available datetime (if $show_expired is false) or the very first datetime order by date if it’s set to true.


July 17, 2017 at 9:37 am

Hi Tony,

Thanks for your response. I had written a reply, then my computer threw a fit.

You are spot on with what you say, and that snippet is doing exactly as i had wanted. Thanks you.

Just to clarify the usage here so i dont open another topic for no reason.

If i change the shortcodes i mentioned above from ‘false’ to ‘true’ this will always bring the first date time back.

Then if i use the snippet that Josh linked me to in order to make the events disappear after the second session i should be able to show my events with only the first date time, until the second date time has been and gone? Does that sound right? it seems to be working, i just want to clarify if that sounds right to you guys.




  • Support Staff

July 17, 2017 at 1:33 pm

Hi Phil,

The code snippet I shared with you actually does nothing with the actual event dates. It’s actually filtering by ticket sale end dates.


July 18, 2017 at 2:23 am

Hi Josh,

I think i get you. When i said about event dates, i set the ticket sale end date to be midnight on the date for the second event time so the date matches. I did some testing last night and set some events up like i would normally and they now display until the end date. And the ticket date and time is displaying as the first date so both boxes ticked now.

Thank you for your time gentlemen, much appreciated.


The support post ‘customising the grid view template.’ 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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3 Documentation for Event Espresso 4

Status: closed

Updated by  Gaviny 2 years, 11 months ago ago

Topic Tags


This topic is:
Do NOT follow this link or you will be banned from the site!