Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created September 30, 2019 23:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshfeck/021690525d4ace23279c3ffa861d69a6 to your computer and use it in GitHub Desktop.
Save joshfeck/021690525d4ace23279c3ffa861d69a6 to your computer and use it in GitHub Desktop.
Change "venue" to "location", and other variations of the term. Event Espresso 4
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter( 'gettext', 'ee_venue_filter_gettext', 10, 3 );
function ee_venue_filter_gettext( $translated, $original, $domain ) {
// This is an array of original strings
// and what they should be replaced with
$strings = array(
'Venue' => 'Location',
'Venue:' => 'Location:',
'Venues' => 'Locations',
'Venue Website:' => 'Location Website:',
'Venue Phone:' => 'Location Phone:',
// Add some more strings here
);
// See if the current string is in the $strings array
// If so, replace its translation
if ( isset( $strings[$original] ) ) {
// This accomplishes the same thing as __()
// but without running it through the filter again
$translations = get_translations_for_domain( $domain );
$translated = $translations->translate( $strings[$original] );
}
return $translated;
}
// change the post type slug URL to be campuses
add_filter( 'FHEE__EE_Register_CPTs__register_CPT__rewrite', 'my_custom_venue_slug', 10, 2 );
function my_custom_venue_slug( $slug, $post_type ) {
if ( $post_type == 'espresso_venues' ) {
$custom_slug = array( 'slug' => 'locations' );
return $custom_slug;
}
return $slug;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment