Support

Home Forums Event Espresso Premium Localize time and dates in ticket details

Localize time and dates in ticket details

Posted: December 2, 2014 at 8:32 am


tigerton

December 2, 2014 at 8:32 am

Hi!

I’m trying to localize the time and dates inside the ticket details slidedown info.

I know the code exists here: /modules/ticket_selector/templates/ticket_selector_chart.template.php
and there it’s using a variable called $date_format. However this variable is never set from what I can see?

I also figured you might be using your builtin locate_template function to fetch this file so I tried placing a copy in uploads/espresso/templates/modules/ticket_selector/templates but it does not seem to work. If it did I could just change the format myself ๐Ÿ™‚

It seems you could really use either a format input in the settings or possibly use the format being set as default in wordpress settings. But in the meantime, is there a solution for me?

Thanks!
/Jonathan


Lorenzo Orlando Caum

  • Support Staff

December 3, 2014 at 7:43 am

Hi Jonathan,

Here are some options on localizing the date and time:

Upcoming Date(s) and Time(s)

FHEE__espresso_list_of_event_dates__date_format
FHEE__espresso_list_of_event_dates__time_format

Ticket Selector

FHEE__EED_Ticket_Selector__display_ticket_selector__date_format
FHEE__EED_Ticket_Selector__display_ticket_selector__time_format

Additional Template Tags

FHEE__espresso_event_date__date_format
FHEE__espresso_event_date__time_format
FHEE__espresso_event_end_date__date_format
FHEE__espresso_event_end_date__time_format
FHEE__espresso_event_date_range__date_format
FHEE__espresso_event_date_range__time_format

And here are some functions:

/**
 * @param string $date_format
 * @return mixed|string|void
 */
function espresso_match_date_format_to_WP( $date_format = '' ) {
    $date_format = get_option('date_format');
    return $date_format;
}
add_filter( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', 'espresso_match_date_format_to_WP', 10, 1 );
add_filter( 'FHEE__espresso_list_of_event_dates__date_format', 'espresso_match_date_format_to_WP', 10, 1 );
add_filter( 'FHEE__espresso_event_date__date_format', 'espresso_match_date_format_to_WP', 10, 1 );
add_filter( 'FHEE__espresso_event_end_date__date_format', 'espresso_match_date_format_to_WP', 10, 1 );
add_filter( 'FHEE__espresso_event_date_range__date_format', 'espresso_match_date_format_to_WP', 10, 1 );



/**
 * @param string $time_format
 * @return mixed|string|void
 */
function espresso_match_time_format_to_WP( $time_format = '' ) {
    $time_format = get_option('time_format');
    return $time_format;
}
add_filter( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', 'espresso_match_time_format_to_WP', 10, 1 );
add_filter( 'FHEE__espresso_list_of_event_dates__time_format', 'espresso_match_time_format_to_WP', 10, 1 );
add_filter( 'FHEE__espresso_event_date__time_format', 'espresso_match_time_format_to_WP', 10, 1 );
add_filter( 'FHEE__espresso_event_end_date__time_format', 'espresso_match_time_format_to_WP', 10, 1 );
add_filter( 'FHEE__espresso_event_date_range__time_format', 'espresso_match_time_format_to_WP', 10, 1 );

Did you try adding that template here?

/wp-content/themes/yourthemefolder


Lorenzo


Brent Christensen

  • Support Staff

December 3, 2014 at 10:00 am

@jonathan

what specific version/branch are you using ?


tigerton

December 4, 2014 at 1:26 am

Lorenzo I’ll try these out in a bit and get back to you!

Brent I’m using the latest stable version of 4.4 ๐Ÿ™‚


tigerton

December 4, 2014 at 3:07 am

Thank you Lorenzo for the functions, they worked perfectly!

You should post these on your documentation!

The support post ‘Localize time and dates in ticket details’ 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