If you want to change the text to something else the easiest way would be to use a translation file in WordPress, this would mean your alterations would persist after updates without needing to keep editing the code.
I’m with Gui here. I’d like to change the text box text as well but as a beginner I don’t understand how to go about using a translation file.
If you could give some more info that would be great.
Would it not be possible to simply include an edit box in the widget dashboard?
Or, on reflection, could you shorten the default text to something like
‘Manage your subscription Profile here’
I get a lot of people wanting to customise the plugin and change the phrases to meet their personal preferences. If I made all of the strings available in the Settings or Widget it would be very daunting to a first time user as there would literally be hundreds of options. I therefore follow the WordPress mantra of ‘choices not options’.
You can make edits to the plugin code to alter the wording but you would lose these changes every time you apply an upgrade which is why I suggest using a translation file instead. This is covered in the WordPress Codex here:
I’m intrigued what the difference between a choice and an option is, but semantics aside, I’m still no wiser as to how to make the change.
I’ve looked at the codex page and to a non-programmer it’s no help whatsoever. I understand that repeating text changes after upgrades is not ideal but it is a whole lot more understandable than the page you linked me to.
My frustration comes from my own lack of knowledge combined with the inability of the experts to communicate to mere mortals.
I would suggest that if you get a lot of people asking how to change the text phrases, that would justify a more elegant solution.
I can understand your frustrations, I used to be the same and somehow ended up developing this plugin!
The difference between a choice and an option is a ‘choice’ is a decision made in the code, an option is a list of possibilities presented to the user. If you present options for all eventualities then the code can rapidly become overwhelming to the most determined of users.
All that aside though, let’s see if I can help a little more on the translation side of things. WordPress and many plugins employ a system for allowing the user presented strings to be ‘translated’. Now this can mean into an entirely different language but it can also be more subtle – for example changing from US English to British English (So color compared to colour for example).
You can use this same system to localise or translate strings in code to your preferred wording.
First you need 2 things, one is a way of translating and the second is the template file to translate. The first would be something like the excellent and free POEdit but other options are discussed in the WordPress codex page I linked above.
The template file you need for Subscribe2 is available on your own server but also here:
Download this file and load it into your chosen translator program. Change the strings you want to alter into your own wording and then save to a PO file (that a person readable file). The last step is then to create a machine readable (or MO) file and load that onto your server into either the plugin directory or wp-includes/languages/.
WordPress may also need configured to look for those files but adding a dfine to your wp-confing.php file, for example like this which uses the French language code. Any lines you haven’t translated will remain at the defaults.
define ('WPLANG', 'fr_FR');
Many thanks for your patient and helpful answer.
I’ll follow your advice and give it a try but can’t promise not to choose the option of asking another basic question..
Well I’ve had a go at most of your instructions but I’m a bit unclear where to upload my new MO file which I have called RDsubscribe2.mo (RD are my initials).
You say ‘The last step is then to create a machine readable (or MO) file and load that onto your server into either the plugin directory or wp-includes/languages/.’ How do I choose?
Also, you say WP may need to be configured with a define. How will I know if it does?
And what exactly is the line I should add? [ define (‘?’, ‘?’)]
Thanks in anticipation.
It’s probably better to upload to ‘wp-includes/languages/’ as that won’t be affected by updates.
You should name the file ‘subscribe2-rd_RD.mo’ and then in the wp-config.php file use this:
define ('WPLANG', 'rd_RD');
Thanks for your prompt reply.
I can’t see a folder called ‘wp-includes/languages/’ so is it ok to create it manually on the server?
And how do I edit the .php file? Do I download it, textedit it and then upload it again? Or is there a better way within WP?
When I did the POedit I opened the original file, then shortened the POT file source text line from ‘You may manage your subscription options from your’ to ‘Manage your subscription in your’. (It’s the ugly alliteration ‘may manage’ that bothers me but after today I’ll live with it)
When I tried to Save As to my new files I got an error saying “header field ‘Project-id-Version’ still has the initial default value” with the warning that the file was saved safely but could not be compiled into the MO format and used. Nonetheless it created an MO file.
In desperation I thought I’d upload and try anyway.
I created a folder ‘wp-includes/languages/’ in which I uploaded my subscribe2-rd_RD.mo file.
I edited wp-config.php and included the define command as you suggested however when I tested my site it had not made any difference.
So. I imagine you’re as fed up with this as I am now. Although having spent a whole day trying to change 8 words and failed, I have now lost the will to live.
You have been very patient with me but making such a trivial change in such a complicated way is nonsense. I started off being frustrated and cross but after all this time I am now merely suicidal.
Don’t despair. Think of this as a learning process instead of just focussing on the goal.
Are you using caching on your site? You may need to clear that out in order to see any change. You may also need to clear your browser cache of your sites files.
Also, it might be worth entering a Project id version in the header of the file and re-creating the mo file just to be sure it isn’t that.
Once again, thanks for your patience.
– I don’t know if I’m using cacheing on my site and I don’t know where to check.
– I went back to POedit & re-did the edit. I changed the version and saved with no errors. I then re-uploaded the MO file into Languages but still no joy.
– I emptied the cache on my browser (Safari) and refreshed the site but no joy.
The site, by the way, is http://www.richardsevents.co.uk
Hmm, try moving the ‘languages/’ you created from the wp-includes/ folder to the wp-content/ one within WordPress.
Sorry for the delay – real-life interrupted the fun.
I moved the languages folder to wp-content, emptied the browser cache, refreshed the page and … still not working.
I also checked that I’d made the define edit correctly in wp-config.php. As far as I can see it’s correct but I noticed there is also a define (‘WPLANG’, ‘en_US’), can they co-exist ok?
- The topic ‘How can I change the text prompt in the Subscribe2 widget?’ is closed to new replies.