Hello,
I want to edit the content of the login default forms, in order to add placeholders and texts for instance.
I also need to translate those forms, and the mail sent to the user after password reset.
How may I do that ?
Is there a way to do it without loosing this after update ?
Thank you.
The shortcode just mimics the output of the standard WordPress login form and doesn't provide any attributes for customisation, other than the urls to redirect to on success or failure.
There is no way to add placeholder text, for example.
However, if you are willing to write some PHP, there is scope to add additional content to the form.
Probably the best way to see what is possible is to look at the source code used to generate the form. In the file wp-content/plugins/wp-views/embedded/inc/wpv-shortcodes.php look for the definition for function wpv_login_form (line 697 in the current version).
You will see there is a filter 'login_form_defaults' you can use to change the form texts.
Then there are filters 'login_form_top', 'login_form_middle', and 'login_form_bottom' where you can insert additional HTML into the form.
We currently have internal tickets for issues where the login form texts have not been correctly registered for translation, and cannot be translated. There are some deeper challenges here which mean that this work is actually ongoing and I'm not sure when it will be fixed.
In the meantime, you can use that 'login_form_defaults' filter to modify the form labels, including providing them in an alternate language.
I'm sorry if the reply implies more work than you were hoping for.
hello and thank you very much,
I just have one more question : by editing the php, I will lose these edits when update.
I could I avoid losing the edit ?
Thanki you.
Instead you add code to your theme's functions.php file (or using a plugin such as Code Snippets) which "hooks" into the source code where you want to make changes.
These filters are a little different as the filter customarily passes a variable to your custom function which modifies the variable and returns it. In this case you simply need to return a string of what you want to add to the form.
It seems a lot more complicated to user filters thank to edit the php file...
If there is no simple other way, I will copy the file after each update...
Thank you.
This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.