Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm designing a custom login template and I need a way to access the <input> html so I can add a label inside the input. I understand the use of wp_login_form() but that only lets me set the default lables outside the input to blank. I need to add the onfocus and onblur attributes to the html. Any ideas?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

There's this basic trick: Close brackets, open again, insert what you need, close again.

Real life example:

$args = array( 
    // some args for the login form
    'value_username' => 'User Name" onBlur="whatever" onFocus="anotherfoo';
);
wp_login_form( $args );

So we closed the brackets after the Username, then added our additional attributes and left the quotes open at the end, so the wp_login_form() function can then close it by itself.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.