Add content to login and register form

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.

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';

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?

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
    ],
];

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

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.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.