Posted: July 29, 2016 at 7:29 am
|
Is it possible to change the language for adding more people to: Register Additional Attendees Click Here and omit (click to toggle, limit #) |
Hello, That is translation ready using a gettext filter (https://eventespresso.com/wiki/how-to-change-wording-with-poedit/#custom-function). Here is the source text: Add More Attendees? (click to toggle, limit %s) — |
|
|
So does this code currently exist in one of your files or do I add this code to custom_functions.php |
Hello, We do not recommend editing the core software. This is because customizations will be lost upon a software update. A gettext filter can be added to a site specific plugin (https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/) or through a child theme’s functions.php. Both of those are safe locations and won’t be lost on a software update. If you have an existing gettext filter in use, then you could add a new entry for the text that I shared. Here are some other examples of gettext filters: https://gist.github.com/lorenzocaum/82523b3d032879b58e6c https://gist.github.com/433446065b3bb5d50c71 — |
|
|
I have not filters in place (didn’t know that they existed). This is kind of out of my comfort zone. Just to be clear, I have a custom_functions.php file under /wp-content/uploads/espresso which doesn’t effect the core or is it easier to find a plugin? |
Hello, If you have an existing file there, then that can be used. I still do recommend keep all customizations (e.g. messaging changes via gettext filters) in one spot rather than across different files. If I were setting this up on my own site, then my first choice would be a child theme’s functions.php file and my second would be a site specific plugin to hold Event Espresso related customizations. That way if you need to change something in the future, then you can add it where you have existing customizations. Does that help? — |
|
|
Lorenzo I was of the impression that keeping a custom_functions.php in /wp-content/uploads/espresso keeps the file safe during any upgrades. So with that said can you give me the location of your gettext filter so I can copy it over into my custom_functions.php file? |
Let me try and clear some of the confusion around the custom_functions.php file. When you declare a function within PHP, another function can not be declared with the same function name (a fatal error will be thrown if that happens). When EE declares its own functions a lot of them check if the function already exists and if so will not declare the function again, but use the existing one. custom_functions.php is a file used within EE3 to allow you to always load your custom functions before EE loads. So basically it’s a method of overriding existing functions within EE because your custom functions load first and then EE checks for those custom functions. The custom_functions.php file you hav in the current location is update safe. However, loading your own custom functions (like the gettext functions above) does NOT override an existing function, it hooks in and changes the output. This is different than what the custom_functions.php file is for so…
You don’t place that within custom_functions.php, you create a Custom Functions Plugin that you can place the function (and others) within. So if you follow custom functions plugin tutorial linked above and add this function: https://gist.github.com/Pebblo/998b051a5b8c357c4458715dfb8b0487 That will translate the string for you.
|
|
|
Ok, that makes sense. I will give it a try. |
|
I followed the tutorial and created a plugin in /wp-content/plugins called “Get File Plugin”. I add your code and edited the text that I wanted changed. When I update the page nothing happens. I am assuming I missed something.
|
Is a different string from what you need to change. This is the text your want to change right? – http://take.ms/s6ygd The code used to output that text is:
So you want to use:
I’ve updated my gist above to match this change so you can view how the code should look. |
|
|
Thanks Tony, that did it. First time making a plugin. |
Nice job, welcome to the plugin club 🙂 I’m glad its now working for you. |
|
|
Tony, can the email for the additional attendees be made required? |
To do that you would need to require the personal information question group for additional registrants, however you requested not to require that information in a previous thread here: https://eventespresso.com/topic/simple-attendee-information-page/#post-211412 So yes it can be done, but it reverts changes your previous requested. |
|
The support post ‘Event registration page – Add More Attendees’ 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.