• Resolved GregF

    (@gregf)


    Hi. I’ve had a request to change the labels for US time zones, e.g. PDT or PST to “Pacific Time”. Is there a hook or template change that would allow this? Thanks.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support Darian

    (@d0153)

    Hi @gregf

    Thanks for reaching out. Let check with the team if there’s a hook that we could use for this one.

    Could I ask for the direct URL of your page where you want those labels change? I’d like to check if we could do it through template override.

    Could you also provide the version of the following? This will help me understand how your system is set up.

    • PHP
    • WordPress
    • The Events Calendar
    • Theme

    Looking forward to your reply.

    Thread Starter GregF

    (@gregf)

    Hi. The main calendar page is https://braverangels.org/events/ and it is these labels that we want to change:

    WordPress: 6.0.3
    PHP: 8.0.28
    The Events Cal: 5.16
    Theme: Astra 3.3.2 (child)

    Plugin Support Darian

    (@d0153)

    Hi @gregf

    Thanks for your response.

    You could try the following snippet code either through functions.php or through Code Snippets plugin:

    add_filter( 'tribe_events_event_schedule_details_inner', function ( $html, $post_id ) {
    	remove_filter( 'tribe_events_event_schedule_details_inner', [
    		Tribe__Events__Timezones::class,
    		'append_timezone'
    	], 10 );
    	$timezone = 'Pacific Time';
    
    	return $html . " <span class='timezone'> $timezone </span>";;
    }, 9, 2 );

    I hope this helps, and please let me know if you have further questions or concerns.

    Thread Starter GregF

    (@gregf)

    This code returned an error, even after closing the parens on line 2:

    The code snippet you are trying to save produced a fatal error on line 2: syntax error, unexpected token "&", expecting ")"

    Also, I don’t see how it would account for time zones other than Pacific.

    Thanks.

    Plugin Support Darian

    (@d0153)

    Hi @gregf

    I tried the same code, but I was not able to encounter the error you’re referring to.
    See- https://share.getcloudapp.com/d5ugOPYl

    The snippet code will only work when you’re using site-wide timezone everywhere and the timezone you selected from General settings is using Pacific time.

    By any chance, are you using different timezones on your events?

    Thread Starter GregF

    (@gregf)

    I was able to load the snippet on a different site, so I’ll have to investigate that error further.

    And yes, I am using different timezones on the events. They take place all over the country and local time is displayed for each one. (Two different timezones were circled on the screenshot that I posted earlier.) I know that complicates things but I’m hoping that the same filter can be used to output the correct label conditionally.

    Thanks.

    Thread Starter GregF

    (@gregf)

    I got the snippet to load on another site without error, so I’ll have to investigate that further.

    And yes, there are different timezones on the events. They take place all over the country and use local time. (Two different timezones were circled on the screenshot I posted earlier.) I know that complicates things but I’m hoping that the same filter can be used to display different labels conditionally. Any help with that would be appreciated.

    Thanks.

    Plugin Support Darian

    (@d0153)

    Hi @gregf ,

    Upon checking, it seems there are no filters available for that. However, you could try overriding your template for the event date in list view by copying the-events-calendar\src\views\v2\list\event\date.php into [your-theme]/tribe/events/v2/list/event/date.php. After that, you can now then manipulate how your timezone will be shown, through PHP string manipulation. e.g., str_replace()

    I hope this helps, and please let me know if you have further questions or concerns.

    Plugin Support Darian

    (@d0153)

    Hi @gregf

    This thread has been inactive for a while, so we’ll go ahead and mark it Resolved. Please open a new thread if any other questions arise, and we’d be happy to help.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Change time zone label’ is closed to new replies.