Opened 8 years ago
Last modified 6 years ago
#39927 new enhancement
Add support for CSS class and attributes in wp_login_form input fields
Reported by: | subrataemfluence | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 4.7.2 |
Component: | Login and Registration | Keywords: | has-patch |
Focuses: | template | Cc: |
Description
I think adding support for class and a few useful attributes like placeholder and required for default login form (wp_login_form).
In wp-includes/general-templates.php
(line 402), if we can pass $args
like this it would be nice:
$args = array( ... 'placeholder_username' => __('Your login Id'), 'placeholder_password' => __('Your password (case sensitive)'), 'username_required' => true, 'password_required' => true, 'username_css_class' => 'form_control, 'password_css_class' => 'form-control 'username_remove_size' => true, 'password_remove_size' => true );
This will have the following benefits:
1) We can use HTML5 native client side validation
2) We can tell WordPress to use custom class name (if none is supplied, default would be used)
3) Placeholder will help removing labels and save space
4) Size attribute if set to true
will not be used. This is useful if I don't need it at all.
Based on the above values the <form>
element also could be modified like this:
$form = '<form ...> <input type="text" <?php if($args["username_required"] == true) echo "required" ... ?> </form>'; if($args['echo']){ echo $form; } else { return $form; }
Attachments (1)
Change History (7)
Note: See
TracTickets for help on using
tickets.
Corrected unterminated strings for
username_css_class
andpassword_css_class
keys.