• Resolved hcmendez

    (@hcmendez)


    I’m using Login Type: Default, Registration Type: Default. Is it possible to add placeholders to these input fields and hide the labels?
    – Username or Email Address: ‘Your username or email address’
    – Password: ‘Your Password’
    – Lost Password field: ‘Enter your username or email address’
    – Recover password fields:
    1. New Password: ‘Enter your new password’
    2. Confirm new password: ‘Enter your new password again’

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Jeff Farthing

    (@jfarthing84)

    
    function add_placeholders_and_hide_labels() {
        // This is your map of forms and their fields to your placeholder text
        $forms = [
            'login' => [
                'log' => 'Your username or email address',
                'pwd' => 'Your password',
                // etc
            ],
            'register' => [
                'user_login' => 'Your username or email address',
                'user_password' => 'Your password',
                // etc
            ],
            // etc
        ];
    
        foreach ( $forms as $form => $fields ) {
            foreach ( $fields as $field => $placeholder ) {
                if ( $field = tml_get_form_field( $form, $field ) ) {
                     $field->add_attribute( 'placeholder', $placeholder );
                     $field->set_label( '' );
                }
            }
        }
    }
    add_action( 'init', 'add_placeholders_and_hide_labels' );
    

    A form and field name reference can be found here: https://docs.thememylogin.com/article/96-form-field-priorities

Viewing 1 replies (of 1 total)
  • The topic ‘Add placeholders to fields’ is closed to new replies.