Support

Home Forums Event Espresso Premium EE4 – Echo Start Time – End Time in Php on custom single page template.

EE4 – Echo Start Time – End Time in Php on custom single page template.

Posted: July 6, 2015 at 2:10 pm

Viewing 14 reply threads


Judy

July 6, 2015 at 2:10 pm

I’ve been searching for a bit and I cannot figure this out.
How can I simply echo out the Event start/end time WITHOUT the date on my custom single page event template?

Eg: 7:30am – 5:00pm

Thank you in advanced.


Lorenzo Orlando Caum

  • Support Staff

July 6, 2015 at 2:41 pm

Hi Judy, the function that shows the date times is pluggable so it can be changed. The example in this link will show only the time without the dates:

https://gist.github.com/lorenzocaum/41f70b94f7c6b212b145


Lorenzo


Judy

July 6, 2015 at 2:53 pm

Thanks so much for your response,
I am not the best with php and I was actually sifting through this file earlier trying to make sense of it and attempting to write some code to echo the times out but I had no luck, could you give me an example of how I would use this to display the start/end times?

Greatly appreciated!


Judy

July 6, 2015 at 2:55 pm

I should mention to that I am only looking to display this information in one spot, so globally showing only the start/date time wouldn’t be ideal. This is just being shown in one spot in my template.

๐Ÿ™‚


Judy

July 6, 2015 at 3:02 pm

An example of what I am trying to acomplish
http://brandinhall.com/header.jpg

I will also be looking to do the same with the base price of the event or in my case the “class”. Is there any reference/docs available for displaying different fields like this to build a template?

Thanks again ๐Ÿ™‚


Lorenzo Orlando Caum

  • Support Staff

July 6, 2015 at 3:03 pm

Hi Judy, the template file that shows the datetimes on the single event page is the same as the one that is used on the event listings page so a change in one area will apply to the other.

espresso_list_of_event_dates is not used in other areas such as the registration checkout page or your WP dashboard.


Lorenzo


Judy

July 6, 2015 at 3:18 pm

okay, thanks.
So there is no way to do like some code that will echo it out eg:
<?php echo espresso_event_date_range('starttime', 'endtime');?>


Lorenzo Orlando Caum

  • Support Staff

July 6, 2015 at 3:20 pm

Your image was helpful. Please see this resource for information on how the templates work together:

https://gist.github.com/0a35fe4997992fdb1dc5

You can use some CSS to make the datetimes appear inline:

https://gist.github.com/lorenzocaum/239b4237bd6b2b52be7a

The function that shows the datetimes is called espresso_list_of_event_dates.


Lorenzo


Judy

July 6, 2015 at 3:29 pm

Thanks,
This works for me:
<?php espresso_list_of_event_dates('', ' ', '', ' ');?>

However it is outputting the html with it and an icon, how can I just output the time without any other formatting or html attached to it?


Judy

July 6, 2015 at 3:32 pm

Sorry I just noticed it is also outputting Other information with it, how do I just echo the start time and end time with no html or anything else?


Lorenzo Orlando Caum

  • Support Staff

July 6, 2015 at 3:51 pm

Alright, could you please try this instead:

ID ); ?>

It should appear like this without the icons:

http://cl.ly/image/451D2A2I0K3J


Lorenzo


Judy

July 6, 2015 at 3:55 pm

PERFECT!
Thank you so much!!!!
Not to be greedy, but could you tell me how I might do the same thing with the price of the event?

And, is there any docs or resources I could reference in the future to output information into my template like this?

Thank you so so so much!


Lorenzo Orlando Caum

  • Support Staff

July 6, 2015 at 4:16 pm

Yes, we have an example of that available. See this file:

http://cl.ly/code/0F1R253u161u

The PHP code snippet between the div for event pricing will show the pricing in this format:

$99


Lorenzo


Judy

July 6, 2015 at 4:51 pm

Thanks, that also worked perfectly.
Appreciate all the help!


Dean

July 7, 2015 at 7:20 am

Hi Judy,

Is this issue resolved now?

Viewing 14 reply threads

The support post ‘EE4 – Echo Start Time – End Time in Php on custom single page 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.

Event Espresso