Posted: December 19, 2014 at 1:44 pm
Hi guys, I have got pretty good at modifying the invoice template to print out custom questions from the registration form and other info. However I am having a major issue with getting the start time of the event to show up properly. After searching through old topics, it looked like this: Should have given me a value, but it seems to always come out as a blank string. Am I missing something? Thanks |
|
Hi Ryan, It matters where the code is placed. I tried the same code and put it inside the loop that starts with |
|
OK, this is strange – I got it to display a time – but its not the right time for the event! Here is my code: $startTime = event_espresso_get_time($event_id, $format = ‘start_time’); The start time that I sent in the event is 8:00 am When I look up in the wp_events_start_end table the start time for the event_id I have, its correct in the table saying 8:00 I’m confused at what is going on. |
|
Josh, I have tried the code (see above) in that loop and outside of it. It just seems like its pulling the wrong time for some reason. Ryan |
|
Hi Ryan, If you look at the event_espresso_get_time() in Event Espresso core, you’ll see that it calls another function that returns a formatted date, it doesn’t return a string. So you do not need to run strtotime on it. I think you can remove this line and it will display the correct time:
|
|
One other thing – it seems to always display 7:00 for all events – so no matter the event ID – its giving me 7:00 for some reason. |
|
Sorry for the quickfire replies. I tried getting rid of $startTime = date(‘g:i a’, strtotime($start_time)); And I get nothing back (empty string) if I just use $startTime = date(‘g:i a’, strtotime($start_time)); I get 7:00 again. Where is the core function (what file/directory?) I would like to take a look |
|
Can you do a project search in your IDE? That’s the quickest way to find it. Otherwise, you can open up /event-espresso/includes/functions/time_date.php. |
|
Josh, Looks like I got a fix. The second parameter was throwing it off for some reason, and when I looked at the source code for the function, I noticed it was optional anyway. So my fix was to simply change this line: to Thanks for the help! |
|
The support post ‘EE3 – Start Time in Invoice PDF?’ 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.