Support

Home Forums Event Espresso Premium People Add-on – Change People label to something else

People Add-on – Change People label to something else

Posted: January 8, 2016 at 8:53 am


Daniel

January 8, 2016 at 8:53 am

How do I change the custom link “People” label that appears in the header on the People page.

My menu item is called Instructors and I’d like to change “People” to “Instructors” to be consistent.


Lorenzo Orlando Caum

  • Support Staff

January 8, 2016 at 10:31 am

Hi, that word can be changed by using a gettext filter:

https://eventespresso.com/wiki/how-to-change-wording-with-poedit/#custom-function

It can be added to your site specific plugin or through a child theme’s functions.php file (if you are using one).


Lorenzo


Daniel

January 8, 2016 at 2:10 pm

Thanks the Quick Localization plugin did the trick


Tony

  • Support Staff

January 8, 2016 at 2:32 pm

Hi Janet,

Just a quick suggestion on improving this.

The quick localization plugin stores your translations within the database, meaning that each translation need to be fetched from the DB first, which slows it down a little. It’s a useful tool, but if your comfortable with PHP you can do is using the custom gettest function at the bottom:

function mycustom_filter_gettext( $translated, $original, $domain ) {
 
    // This is an array of original strings
    // and what they should be replaced with
    $strings = array(
        'People' => 'Instructors',
    );
 
    // 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;
}
 
add_filter( 'gettext', 'mycustom_filter_gettext', 10, 3 );

Each translation just goes on a new line within the $strings array, like this:

$strings = array(
      'People' => 'Instructors',
      'Another string' => 'Another translation',
      'And another' => 'This is another translation',
);

(original string on the left, translation on the right)

You can continue to use the quick localization plugin if you prefer, this will just be slightly quicker.


Tony

  • Support Staff

January 8, 2016 at 2:33 pm

Oh and you can just place that function within your child themes functions.php file.


Daniel

January 8, 2016 at 2:39 pm

I would prefer that over the plugin but it doesn’t work.


Tony

  • Support Staff

January 8, 2016 at 2:57 pm

Are those strings the same strings you used in the Quick Localization plugin?


Daniel

January 8, 2016 at 3:19 pm

yes

The support post ‘People Add-on – Change People label to something else’ 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