In this document:
Introduction
The default text in the booking calendar is for general booking purposes. But, sometimes, it’s necessary to change the default text, including headers and titles, to make more sense to your customers and business.
This guide explains the four methods you can use to change the default text in the booking calendar:
- Using the Translate Words plugin: This is a simple, lightweight plugin for those that want to customize a couple of phrases.
- Using the Loco Translate plugin: This is a good option for those that want to get involved with their custom translations and don’t want to use our WordPress translation system.
- No plugin: Adding to your theme’s functions.php file
- Code Snippets plugin to add PHP: Alternative to adding to the functions.php file
What This is Useful For
- Change the name and email address field label in the booking form
- Say something other than, “What type of appointment are you booking?”
- Translation included in language pack not in the proper form.
This guide will only allow you to customize the default phrasing provided by our plugin. If you have created custom fields and would like to change text, follow this guide on editing Custom Fields. You can even customize these fields in your preferred language.
Translate Words Plugin
Translate Words is a free plugin that allows you to translate the original plugin text, theme text, and translations that have been created. To get started, install and activate the Translate Words plugin.
If you are using other plugins that have the same default phrases, it will change the phrases in all plugins. If you only want to edit the phrase in SSA, we recommend using Loco Translate instead.
You can use this method to quickly change text:
- Headings
- “What type of appointment are you booking?”
- “Select a Date”
- “Select a time”
- “You are booking”
- “Book This Appointment” button
Adding Words to the Translate Words Plugin
After activating, go through the SSA booking process and determine which phrases you want to change. When ready, go to the WordPress Dashboard > Settings > Translate Words.
For example, I want to change the “Select a date” heading to “Choose a date.”
After clicking into Translate Words, you’ll add the phrases:
- “Select a date” under the “Current” column
- “Choose a date” under the “New” column
Click Add Translation and then Save.
The phrases input into the “Current” column are not case-sensitive. The phrases that are put into the “New” column are what will be displayed in the plugin, so make sure you type this column correctly!
And that’s it! The phrase you wanted to translate in the plugin should display your new phrase.
Loco Translate Plugin
Loco Translate is a free plugin to edit built-in plugin field labels. First, you’ll want to install and activate the Loco Translate plugin.
Create a New Language Profile
After activating Loco Translate, look for the Loco Translate tab on the bottom left side of your WordPress Dashboard.
Click on it, and then choose “Plugins”
You should see a full list of all the plugins installed on your site. Click Simply Schedule Appointments, and then click New Language.
The next screen will show two steps.
In the first step, choose the language that you currently use on your WordPress site. On the second step, choose System. When you’re ready, click Start Translating.
Start Translating
After creating the new language profile, you can now start translating and changing the text!
The top half of the screen displays a list of all the different phrases in Simply Schedule Appointments. You can use the filter section to search for the phrase you want to change.
Let’s say we want to change the default “Name” field to display as “Please enter your full legal name”. We can follow these steps to change the field label:
- Use the filter to search for “Name”.
- Click on the field label “Name”.
- Towards the bottom of the screen, you will see an area for the translated text. Enter the new phrase here.
- Click Save.
Check the Simply Schedule Appointments booking form to make sure that it’s working:
And that’s it! You can repeat the steps above for any other built-in labels you’d like to change.
No Plugin: Adding to the functions.php File
If you’re comfortable with adding PHP code to your functions.php file (or a custom plugin), this code should help you achieve the same thing as LocoTranslate without adding the performance overhead of another plugin:
add_filter( 'gettext', 'customize_ssa_button_text', 100, 3 );
function customize_ssa_button_text( $translated_text, $text, $domain )
{
if ( $domain !== 'simply-schedule-appointments' )
{
return $translated_text;
}
// Replace only OLD_TEXT
if ( $text === 'OLD_TEXT' ) {
return 'NEW_TEXT';
}
return $translated_text;
}
Just make sure to make the proper replacements in this bit of code, for example:
if ( $text === 'There are no available appointment times.' ) {
return 'Sorry, there are no appointments at this time. Check again Monday morning :)';
}
Replacing all instances of a word
If you want to replace a word across the entire plugin, you could use the following snippet. Keep in mind that str_replace is case-sensitive, so ‘Appointment’ and ‘appointment’ are different.
$translated_text = str_replace('EXISTING_WORD', 'NEW_WORD', $translated_text);
//For example, if I want to replace all instances of 'Appointment' with 'Meeting', I'd have to write something like -
$translated_text = str_replace('appointment', 'meeting', $translated_text);
$translated_text = str_replace('Appointment', 'Meeting', $translated_text);
So, if you were replacing phrases and also wanted to replace all the instances of a word, your snippet would look like this:
add_filter( 'gettext', 'customize_ssa_button_text', 100, 3 );
function customize_ssa_button_text( $translated_text, $text, $domain )
{
if ( $domain !== 'simply-schedule-appointments' )
{
return $translated_text;
}
// Replace only OLD_TEXT
if ( $text === 'OLD_TEXT' ) {
return 'NEW_TEXT';
}
// Replace all instances of EXISTING_WORD
$translated_text = str_replace('EXISTING_WORD', 'NEW_WORD', $translated_text);
return $translated_text;
}
Accessing the functions.php File
In your WordPress Dashboard, go to Appearance > Theme Editor. On the right-side, you should see a sidebar with files. Select the functions.php file.
Scroll all the way to the bottom and paste in the above code, ensuring you’ve properly replaced the old text and new text fields.
Click Update File and that should be it!
Using the Code Snippets Plugin: Adding PHP
Another alternative is to use the PHP code from the above section and enter it into the free Code Snippets plugin instead of the functions.php file. This is a lightweight option that will also be useful in case you need to add other custom code to your site.
After you install and activate the plugin, go to Snippets > Add New and enter the PHP from above into the Code editor.
Leave the “Run snippet everywhere” button selected. And, don’t forget to enter a Title and Description to help you remember what the code does. When you’re done click Save Changes and Activate.