Change Text?
-
Hi!
How can I change the text so that when the plugin gets updated it doesn’t override what I’ve changed?
For example I don’t want it to say “Guestbook Entry” etc…
Thanks!
Matt
-
There are filters that you can use.
Which text at which places would you want to be changed?Thanks for the response, and can I say this plugin is excellent!
Ideally I want to change some of the text from frontend/write.php, including:
>> Write a new entry.
Guestbook entryI also want to remove the * from the required fields.
ALSO: Another request, in the widget can you ask it to show a random entry, rather than the latest?
Thanks!
MattThis will change the text of the button:
function my_gwolle_gb_button($html) { $old = '» Write a new entry.'; $new = 'New String'; $html = str_replace( $old, $new, $html ); //var_dump($html); return $html; } add_filter( 'gwolle_gb_button', 'my_gwolle_gb_button' );function my_gwolle_gb_write($html) { $old = 'Guestbook entry'; $new = 'New String'; $html = str_replace( $old, $new, $html ); $old = '\*'; $new = ''; $html = str_replace( $old, $new, $html ); //var_dump($html); return $html; } add_filter( 'gwolle_gb_write', 'my_gwolle_gb_write' );Not sure about this last function where the * gets replaced. Please test.
You can place this code in functions.php of your theme or in your own plugin.
I will think about the feature for the widget.I’m curious and since I just began looking at this guestbook, is there a PO file too for easy editing of original strings or it’s hardcoded?
Translations are done at GlotPress:
https://translate.ww.wp.xz.cn/projects/wp-plugins/gwolle-gb
If you have a PO file it will get overwritten with updates, so that isn’t really a viable option.Then how to edit original english strings? I don’t know yet if I will need this but this button was a good example so was wondering if one need to use a function each time.
Also I plan to to my own french because french translators from France use more english than we do here in Canada sometimes so if I take the GlotPress route and work on French Canada, all future updates will have the correct translation? On the other hand, if I do it on my side I will need to keep a PO file safe to put back after each update?
If I ever decide to work on French Canada, can I use POedit to do it locally then upload the .po file or I absolutly need to edit at GlotPress? I would prefer to work offline and upload once completed and tested.
I’ll add another example: Admin Reply by:
Since I’m the only admin I would like to change that string to Rhialto’s reply: and get rid of the name after colon (:)
I understand I can’t change it if it’s hardcoded or I will lost the change with next update, still not sure it’s editable in a PO file as I don’t see one. So what are my option, do I need to create a function based on the one above?
Thanks!
The strings are hardcoded in the PHP code. The filters are there for this type of customizing.
The Settings page is already crowded enough already…I thought I would be good and quite understand the filter thing but it’s not working so I must be missing something:
function my_gwolle_gb_entry_read_add_after($html) { $old = 'Admin Reply:'; $new = 'Test'; $html = str_replace( $old, $new, $html ); //var_dump($html); return $html; } add_filter( 'gwolle_gb_entry_read_add_after', 'my_gwolle_gb_entry_read_add_after' );Hi, for the list you probably want to use the filter:
‘gwolle_gb_entries_read’Weird, pretty sure I tried it and it wasn’t working but now it works…
Thanks!
Hello,
I have installed your plugin, very nice, compliments!
I have a question…
I would not use it to a “Guestbook” in Spanish I have called it “Pizarra de Mensajes y Foro” and then I would like to change 4 written if is possible..
the 3 written in the spanish version are “Dejar una firma en el libro” (button), “Firma en el libro:” (outside the form), “Firma en el libro” (inside the form) and “¡Firmar!”; I would like to change the first three with “Ingresa tu mensaje” and the last one with “Enviar”
it is possible to made this changes?
many thanks!Hi, you can use the PHP filters that are listed above. You can replace text with them.
I can not find the code to be replaced … can you tell me please where is it?
I will need to change not only the button but also other parts of the text that I have indicated.. could you tell me please if it is possible to do to… thanks!sorry! I read with more attention what you wrote and I understand 🙂
I have inserted the codes provided in the files function.php of theme and I solved 🙂
sorry but I will like to made question…
why is not possible just changed the gwolle-gb-es_ES.po files?
already many thanks!
The topic ‘Change Text?’ is closed to new replies.