WordPress.org

Make WordPress Core

Ticket #40462: 40462.5.patch

File 40462.5.patch, 6.7 KB (added by ramiy, 3 years ago)

add label classes

  • wp-includes/general-template.php

     
    362362 * The login format HTML is echoed by default. Pass a false value for `$echo` to return it instead.
    363363 *
    364364 * @since 3.0.0
     365 * @since 4.9.0 `$placeholder_username`, `$placeholder_password`, `$label_class_username` and
     366 *              `$label_class_password` arguments added.
    365367 *
    366368 * @param array $args {
    367369 *     Optional. Array of options to control the form output. Default empty array.
    368370 *
    369  *     @type bool   $echo           Whether to display the login form or return the form HTML code.
    370  *                                  Default true (echo).
    371  *     @type string $redirect       URL to redirect to. Must be absolute, as in "https://example.com/mypage/".
    372  *                                  Default is to redirect back to the request URI.
    373  *     @type string $form_id        ID attribute value for the form. Default 'loginform'.
    374  *     @type string $label_username Label for the username or email address field. Default 'Username or Email Address'.
    375  *     @type string $label_password Label for the password field. Default 'Password'.
    376  *     @type string $label_remember Label for the remember field. Default 'Remember Me'.
    377  *     @type string $label_log_in   Label for the submit button. Default 'Log In'.
    378  *     @type string $id_username    ID attribute value for the username field. Default 'user_login'.
    379  *     @type string $id_password    ID attribute value for the password field. Default 'user_pass'.
    380  *     @type string $id_remember    ID attribute value for the remember field. Default 'rememberme'.
    381  *     @type string $id_submit      ID attribute value for the submit button. Default 'wp-submit'.
    382  *     @type bool   $remember       Whether to display the "rememberme" checkbox in the form.
    383  *     @type string $value_username Default value for the username field. Default empty.
    384  *     @type bool   $value_remember Whether the "Remember Me" checkbox should be checked by default.
    385  *                                  Default false (unchecked).
     371 *     @type bool   $echo                 Whether to display the login form or return the form HTML code.
     372 *                                        Default true (echo).
     373 *     @type string $redirect             URL to redirect to. Must be absolute, as in
     374 *                                        "https://example.com/mypage/". Default is to redirect back to the
     375 *                                        request URI.
     376 *     @type string $form_id              ID attribute value for the form. Default 'loginform'.
     377 *     @type string $label_username       Label for the username or email address field. Default
     378 *                                        'Username or Email Address'.
     379 *     @type string $label_password       Label for the password field. Default 'Password'.
     380 *     @type string $label_remember       Label for the remember field. Default 'Remember Me'.
     381 *     @type string $label_log_in         Label for the submit button. Default 'Log In'.
     382 *     @type string $label_class_username Label class attribute value for the username field. Default empty.
     383 *     @type string $label_class_password Label class attribute value for the password field. Default empty.
     384 *     @type string $id_username          ID attribute value for the username field. Default 'user_login'.
     385 *     @type string $id_password          ID attribute value for the password field. Default 'user_pass'.
     386 *     @type string $id_remember          ID attribute value for the remember field. Default 'rememberme'.
     387 *     @type string $id_submit            ID attribute value for the submit button. Default 'wp-submit'.
     388 *     @type string $placeholder_username Placeholder attribute value for the username field. Default empty.
     389 *     @type string $placeholder_password Placeholder attribute value for the password field. Default empty.
     390 *     @type bool   $remember             Whether to display the "rememberme" checkbox in the form.
     391 *     @type string $value_username       Default value for the username field. Default empty.
     392 *     @type bool   $value_remember       Whether the "Remember Me" checkbox should be checked by default.
     393 *                                        Default false (unchecked).
    386394 *
    387395 * }
    388396 * @return string|void String when retrieving.
     
    397405                'label_password' => __( 'Password' ),
    398406                'label_remember' => __( 'Remember Me' ),
    399407                'label_log_in' => __( 'Log In' ),
     408                'label_class_username' => '',
     409                'label_class_password' => '',
    400410                'id_username' => 'user_login',
    401411                'id_password' => 'user_pass',
    402412                'id_remember' => 'rememberme',
    403413                'id_submit' => 'wp-submit',
     414                'placeholder_username' => '',
     415                'placeholder_password' => '',
    404416                'remember' => true,
    405417                'value_username' => '',
    406418                // Set 'value_remember' to true to default the "Remember me" checkbox to checked.
     
    459471                <form name="' . $args['form_id'] . '" id="' . $args['form_id'] . '" action="' . esc_url( site_url( 'wp-login.php', 'login_post' ) ) . '" method="post">
    460472                        ' . $login_form_top . '
    461473                        <p class="login-username">
    462                                 <label for="' . esc_attr( $args['id_username'] ) . '">' . esc_html( $args['label_username'] ) . '</label>
    463                                 <input type="text" name="log" id="' . esc_attr( $args['id_username'] ) . '" class="input" value="' . esc_attr( $args['value_username'] ) . '" size="20" />
     474                                <label for="' . esc_attr( $args['id_username'] ) . '" class="' . esc_attr( $args['label_class_username'] ) . '">' . esc_html( $args['label_username'] ) . '</label>
     475                                <input type="text" name="log" id="' . esc_attr( $args['id_username'] ) . '" class="input" placeholder="' . esc_attr( $args['placeholder_username'] ) . '" value="' . esc_attr( $args['value_username'] ) . '" size="20" />
    464476                        </p>
    465477                        <p class="login-password">
    466                                 <label for="' . esc_attr( $args['id_password'] ) . '">' . esc_html( $args['label_password'] ) . '</label>
    467                                 <input type="password" name="pwd" id="' . esc_attr( $args['id_password'] ) . '" class="input" value="" size="20" />
     478                                <label for="' . esc_attr( $args['id_password'] ) . '" class="' . esc_attr( $args['label_class_password'] ) . '">' . esc_html( $args['label_password'] ) . '</label>
     479                                <input type="password" name="pwd" id="' . esc_attr( $args['id_password'] ) . '" class="input" placeholder="' . esc_attr( $args['placeholder_password'] ) . '" value="" size="20" />
    468480                        </p>
    469481                        ' . $login_form_middle . '
    470482                        ' . ( $args['remember'] ? '<p class="login-remember"><label><input name="rememberme" type="checkbox" id="' . esc_attr( $args['id_remember'] ) . '" value="forever"' . ( $args['value_remember'] ? ' checked="checked"' : '' ) . ' /> ' . esc_html( $args['label_remember'] ) . '</label></p>' : '' ) . '