Seegon
October 9, 2022, 8:19pm
1
Im trying to add some custom content/html to the user login and registration form, but not sure what Hook to use.
The hivepress/v1/forms/user-login doesn’t seem to work.
Is it perhaps hivepress/v1/templates/user-login or something else. May I have an example please?
Thank you.
ihor
October 10, 2022, 7:31pm
2
Please try this one hivepress/v1/forms/user_login
(hooks always use underscores). It accepts and returns an array of the form parameters, so you can add the form description
, add custom HTML to its header
or footer
:
$form['description']='custom text';
Seegon
October 10, 2022, 8:45pm
3
Thank you for the answer.
If I were to add a custom button with my own set of classes, just after the password input, can you show me how I would go about adding that?
ihor
October 11, 2022, 1:50pm
5
If this button is required between the last field and the submit button, then the only way is to add a new field of a button type:
$form['fields']['my_button']=[
'type' => 'button',
'caption' => 'Button Text',
'attributes' => [
// array of HTML attributes
],
];
Seegon
October 13, 2022, 2:21pm
6
Hello. Thank you, this solution works, however the filter adds a button element that already contains a few classes like .button.
Nothing i cannot work around, but a minor annoyance.
Thank you
ihor
October 14, 2022, 11:38am
8
Unfortunately there’s no way to insert fully custom HTML between the fields and the submit button yet, this is the only workaround, but you can add custom HTML to the form header or footer.
system
Closed
November 13, 2022, 11:38am
9
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.