Support

Home Forums Event Espresso Premium EE4 – Event list, turn off display of some dates/times but not others

EE4 – Event list, turn off display of some dates/times but not others

Posted: February 19, 2016 at 11:17 am

Viewing 7 reply threads


PKadmin

February 19, 2016 at 11:17 am

I have searched through the help forums to try to figure out how to turn off the display of dates/times for some events and not others on the event listing page. If an event does not have a date I would like to display something like “Please Call for Information” instead. I was able to use CSS to turn off date/time on event detail page, but not on the listing page.


Josh

  • Support Staff

February 19, 2016 at 12:21 pm

You should be able to use something like:

#ee-event-datetimes-ul-12345 {
display:none;
}

to hide the date on the event list for a specific event (in the above example, the event’s ID is 12345).


PKadmin

February 19, 2016 at 1:06 pm

Josh,
Thank you for the response. The CSS you sent worked and I am good with editing CSS. Unfortunately, the folks who will be entering the Dates/Times for courses aren’t that skilled. Is there anyway to use the existing date/time fields in the event to indicate no date/time. Or maybe add some kind of ‘if’ statement to the event list template page that if the date/time is 1/1/2020 (or whatever year) don’t show the date/time. I was going to try that, but wasn’t sure where to find the template pages and how to name/edit a copy.
Any information you can help me with…or guide me to would be great.


Josh

  • Support Staff

February 19, 2016 at 1:42 pm

The first thing I can suggest is you don’t need to add any templates. You can use hooks instead.

Another suggestion: You can use the Advanced Custom Fields plugin to add a toggle field to the event editor (ie Display Dates? Yes or No).

Then, you can use the value that’s set from the Display Dates field in your own custom version of the espresso_list_of_event_dates() template tag. If you open up the espresso_list_of_event_dates() function in a code editor, you’ll see that it’s a pluggable function. So you can copy the function into the theme’s functions.php file or into your own custom plugin and add an if statement in there.


PKadmin

February 19, 2016 at 2:22 pm

OK Josh,
Suggestion #2 sounds like it would work. Adding a Yes/No to the dates option will work best for my users. I think I’m good with then adding that value to a custom function. I suppose my last question is…where do I find the espresso template or function files? I have two folders in my wp-content/plugins. One called event-espresso-core-master and the other event-espresso-core-reg. Which one has the files I’m looking for? I am using Version 4.8.33.p which is the active plugin, but I still have Version 4.8.28.rc.005 as an inactive plugin.


Lorenzo Orlando Caum

  • Support Staff

February 19, 2016 at 2:28 pm

Hi, you can remove this folder which is for the old version that may have been in use in the past:

/wp-content/plugins/event-espresso-core-master

4.8.33 (current release) will be this folder:

/wp-content/plugins/event-espresso-core-reg


Lorenzo


PKadmin

February 19, 2016 at 2:43 pm

DONE! Deleted the old version’s plugin which removed the folder. Also added the Custom field to the event page.
So now I’m looking in the correct folder…but I don’t see a templates folder. Can you give me a little more information on where I find the code I need to edit and where I should put my call to my custom field’s value. I apologize for not understanding Josh’s previous post…just need a little more help. Thank you.


Josh

  • Support Staff

February 19, 2016 at 4:27 pm

You don’t edit any of the files in Event Espresso itself.

Here’s the actual code of the function you’ll be working with:

http://code.eventespresso.com/source-function-espresso_list_of_event_dates.html#467

It’s up to you where you want to add your if {} statement.

You can add your custom code to a functions plugin or into your WordPress theme’s functions.php file.

Viewing 7 reply threads

The support post ‘EE4 – Event list, turn off display of some dates/times but not others’ 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