The featured snippet here will help you change any piece of text in The Events Calendar and its add-ons. With a little bit of modification, it would even allow you to change the wording of any piece of text anywhere in WordPress, not just this plugin!

First copy/paste the snippet at the bottom of this page to your theme’s functions.php. You may need to remove the opening <?php tag if your theme’s functions.php already has one.

This snippet already contains two wording changes, which you can use as a template for the changes you want to make. This changes the phrase “Related Events” to “Similar Events” and “Venue” to “Location.” This is the magic bit right here:

$custom_text = [
  'Venue' => 'Location',
  'Related %s' => 'Similar %s',
];

To change a particular set of text, you must first copy it exactly as it appears in the code. Frequently it appears the same on the front-end. For instance, to change the wording of “Related Events” to say “Similar Events”, you can simply copy the text from the front end. You will then paste it as a key inside of the $custom_text array inside of the snippet as in the above example. You can add as many lines as you want by following the same pattern.

KB example Similar Events

Sometimes the text you want to change cannot be copy-pasted from the front end. For instance, by default, the label in the Events Bar has a CSS style that transforms <label>s to all caps. If we copy-pasted “SEARCH” or “WEEK OF” they will not replace the text we want, because that is not how they appear in the code. If we inspect these elements we will see something like this:

<label>Search</label>

In order to change that label, we would have to copy it as it appears in the code, namely “Search”, not “SEARCH”. An example which changes “Search” to “Find”:

$custom_text = [
  'Related %s' => 'Similar %s',
  'Search' => 'Find', 
];

In the above examples, you may have been wondering what the %s is all about. Those are placeholders for words that the translation does not change. So `Related %s` allows you to change the word “Events” (in the settings), but is not responsible for translating it – it only translates the word “Related”.

⚠️ Note: On rare occasions, this can be even more complicated when multiple strings are concatenated together. An example would be a heading like “Events for the week of November 24, 2014.” When attempting to edit these it might become necessary to dive into the PHP code and determine how the individual strings appear in the code, and what their gettext $text value is.

To help get more accurate translations, WordPress provides translations with context and translations for singular/plural. These use slightly different filters to account for the extra information, and may not get caught by the gettext filter. Since we use these in some places, we have included examples addressing these in the code below as well.

And here is the full snippet:

<?php

/*
 * EXAMPLE OF CHANGING ANY TEXT (STRING) IN THE EVENTS CALENDAR
 * See the codex to learn more about WP text domains:
 * http://codex.wordpress.org/Translating_WordPress#Localization_Technology
 * Example Tribe domains: 'tribe-events-calendar', 'tribe-events-calendar-pro'...
 */

/**
 * Put your custom text here in a key => value pair
 * Example: 'Text you want to change' => 'This is what it will be changed to'.
 * The text you want to change is the key, and it is case-sensitive.
 * The text you want to change it to is the value.
 * You can freely add or remove key => values, but make sure to separate them with a comma.
 * This example changes the label "Venue" to "Location", "Related Events" to "Similar Events", and "(Now or date) onwards" to "Calendar - you can discard the dynamic portion of the text as well if desired.
*/
function tribe_replace_strings() {
	$custom_text = [
		'Venue' => 'Location',
		'Related %s' => 'Similar %s',
		'%s onwards' => 'Calendar',
	];

	return $custom_text;
}



function tribe_custom_theme_text ( $translation, $text, $domain ) {
	// If this text domain doesn't start with "tribe-", "the-events-", or "event-" bail.
	if ( ! check_if_tec_domains( $domain ) ) {
		return $translation;
	}

	// String replacement.
	$custom_text = tribe_replace_strings();

	// If we don't have replacement text in our array, return the original (translated) text.
	if ( empty( $custom_text[$translation] ) ) {
		return $translation;
	}

	return $custom_text[$translation];
}



function tribe_custom_theme_text_plurals ( $translation, $single, $plural, $number, $domain ) {
	// If this text domain doesn't start with "tribe-", "the-events-", or "event-" bail.
	if ( ! check_if_tec_domains( $domain ) ) {
		return $translation;
	}

	/** If you want to use the number in your logic, this is where you'd do it.
	 * Make sure you return as part of this, so you don't call the function at the end and undo your changes!
	 */

	// If we're not doing any logic up above, just make sure your desired changes are in the $custom_text array above (in the `tribe_custom_theme_text` filter. )
	if ( 1 === $number ) {
		return tribe_custom_theme_text ( $translation, $single, $domain );
	} else {
		return tribe_custom_theme_text ( $translation, $plural, $domain );
	}
}



function tribe_custom_theme_text_with_context ( $translation, $text, $context, $domain ) {
	// If this text domain doesn't start with "tribe-", "the-events-", or "event-" bail.
	if ( ! check_if_tec_domains( $domain ) ) {
		return $translation;
	}

	/** If you want to use the context in your logic, this is where you'd do it.
	 * Make sure you return as part of this, so you don't call the function at the end and undo your changes!
	 * Example (here, we don't want to do anything when the context is "edit", but if it's "view" we want to change it to "Tribe"):
	 * if ( 'edit' === strtolower( $context ) ) {
	 *    return $translation;
	 * } elseif( 'view' === strtolower( $context ) ) {
	 *    return "Tribe";
	 * }
	 *
	 * Feel free to use the same logic we use in tribe_custom_theme_text() above for key => value pairs for this logic.
	 */

	// If we're not doing any logic up above, just make sure your desired changes are in the $custom_text array above (in the `tribe_custom_theme_text` filter. )
	return tribe_custom_theme_text ( $translation, $text, $domain );
}



function tribe_custom_theme_text_plurals_with_context ( $translation, $single, $plural, $number, $context, $domain ) {
	// If this text domain doesn't start with "tribe-", "the-events-", or "event-" bail.
	if ( ! check_if_tec_domains( $domain ) ) {
		return $translation;
	}

	/**
	 * If you want to use the context in your logic, this is where you'd do it.
	 * Make sure you return as part of this, so you don't call the function at the end and undo your changes!
	 * Example (here, we don't want to do anything when the context is "edit", but if it's "view" we want to change it to "Tribe"):
	 * if ( 'edit' === strtolower( $context ) ) {
	 *    return $translation;
	 * } elseif( 'view' === strtolower( $context ) ) {
	 *    return "cat";
	 * }
	 *
	 * You'd do something as well here for singular/plural. This could get complicated quickly if it has to interact with context as well.
	 * Example:
	 * if ( 1 === $number ) {
	 *    return "cat";
	 * } else {
	 *    return "cats";
	 * }
	 * Feel free to use the same logic we use in tribe_custom_theme_text() above for key => value pairs for this logic.
	 */

	// If we're not doing any logic up above, just make sure your desired changes are in the $custom_text array above (in the `tribe_custom_theme_text` filter. )
	if ( 1 === $number ) {
		return tribe_custom_theme_text ( $translation, $single, $domain );
	} else {
		return tribe_custom_theme_text ( $translation, $plural, $domain );
	}
}

function check_if_tec_domains( $domain ) {
	$is_tribe_domain = strpos( $domain, 'tribe-' )      === 0;
	$is_tec_domain   = strpos( $domain, 'the-events-' ) === 0;
	$is_event_domain = strpos( $domain, 'event-' )      === 0;

	// If this text domain doesn't start with "tribe-", "the-events-", or "event-" bail.
	if ( ! $is_tribe_domain && ! $is_tec_domain && ! $is_event_domain ) {
		return false;
	}

	return true;
}

// Base.
add_filter( 'gettext', 'tribe_custom_theme_text', 20, 3 );
// Plural-aware translations.
add_filter( 'ngettext', 'tribe_custom_theme_text_plurals', 20, 5 );
// Translations with context.
add_filter( 'gettext_with_context', 'tribe_custom_theme_text_with_context', 20, 4 );
// Plural-aware translations with context.
add_filter( 'ngettext_with_context', 'tribe_custom_theme_text_plurals_with_context', 20, 6 );