Change Events Calendar Strings Without Editing Language Files
Until now, if you wanted to change labels and strings in the Events Calendar you could edit the language files as outlined in this FAQ post. Now we have a new solution contributed by one of our users that allows you to change strings in your themes functions.php file. To do this, just add this snippet to your themes functions.php file (preferably at the end):
add_filter( 'gettext', 'krogs_event_change_venue_name', 20, 3 );
/**
* Change comment form default field names.
*
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function krogs_event_change_venue_name( $translated_text, $text, $domain ) {
if ( $translated_text == 'Venue:' && $domain == 'tribe-events-calendar' ) {
$translated_text = __( 'Location:', 'tribe-events-calendar' );
} elseif( $translated_text == 'Start:' && $domain == 'tribe-events-calendar' ) {
$translated_text = __( 'Begin:', 'tribe-events-calendar' );
}
return $translated_text;
}
You can add as many elseif conditions as you want to add additional strings to translate. To find strings to translate, just look in any of the template views in /wp-content/plugins/the-events-calendar/views or /wp-content/plugins/events-calendar-pro/views for strings like _e(‘Phone:’, ‘tribe-events-calendar’) in /wp-content/plugins/the-events-calendar/views/single.php
If you have any questions, please comment below and we’ll do our best to help you.
