← WordPress

wordpress login form

Lida 2196 vezes

Offline

Nuno 
Administrador
Mensagens 7780 Gostos 216
Feedback +2

Troféus totais: 42
Trófeus: (Ver todos)
100 Poll Votes Level 7 Search Mobile User Level 6 Super Combination Combination Topic Starter 50 Poll Votes 10 Poll Votes

Estou a tentar inserir uma form de login no wordpress, tudo bem, sem problemas. Mas não estou a conseguir inserir por defeito o texto "utilizador" e "password" dentro da label. Alguém sabe como se coloca isto, já procurei e não encontrei nenhuma form com estes textos por defeito lá dentro.

Código: [Seleccione]
<ul>
<li>
<form action="<?php bloginfo('url'?>/wp-login.php" method="post">

<li><label for="log"><input type="text" name="log" id="log" value="<?php echo wp_specialchars(stripslashes($user_login), 1?>" size="10"  /></label></li>
<li><label for="pwd"><input type="password" name="pwd" id="pwd" size="10" /></label></li>
<input type="submit" name="submit" value="Login" class="button" />
<li><label for="rememberme"><input name="rememberme" id="rememberme" type="checkbox" checked="checked" value="forever" /></label></li>

<input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>"/>
</form>


<li><a href="<?php bloginfo('url'?>/wp-register.php">Registar</a> |</li>
<li><a href="<?php bloginfo('url'?>/wp-login.php?action=lostpassword">Recuperar password</a></li>
           
</ul>

<?php endif // get_option('users_can_register') ?>
Offline

Pedro Lopes 
Beta tester
Mensagens 3568 Gostos 18
Feedback +6

Troféus totais: 32
Trófeus: (Ver todos)
Level 6 Windows User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3

Não percebi... :S Não tás a falar do value=""?
Offline

Nuno 
Administrador
Mensagens 7780 Gostos 216
Feedback +2

Troféus totais: 42
Trófeus: (Ver todos)
100 Poll Votes Level 7 Search Mobile User Level 6 Super Combination Combination Topic Starter 50 Poll Votes 10 Poll Votes

Não percebi... :S Não tás a falar do value=""?

Sim... Mas neste caso no nome de utilizador o campo value já está preenchido. E se tentares no campo da password só aparecem os asteriscos. Logo acho que é preciso mandar aqui umas marteladas no código que não estou a conseguir.
Offline

Pedro Lopes 
Beta tester
Mensagens 3568 Gostos 18
Feedback +6

Troféus totais: 32
Trófeus: (Ver todos)
Level 6 Windows User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3

Ahh, sim, é normal. O que podes fazer é meter um input de texto, e com jquery(única que sei) onfocus, mudar para password, ou então meter a password sempre visível.
Offline

Nuno 
Administrador
Mensagens 7780 Gostos 216
Feedback +2

Troféus totais: 42
Trófeus: (Ver todos)
100 Poll Votes Level 7 Search Mobile User Level 6 Super Combination Combination Topic Starter 50 Poll Votes 10 Poll Votes

Pois estou a tentar com o onfocus... Deixa cá ver
Offline

Nuno 
Administrador
Mensagens 7780 Gostos 216
Feedback +2

Troféus totais: 42
Trófeus: (Ver todos)
100 Poll Votes Level 7 Search Mobile User Level 6 Super Combination Combination Topic Starter 50 Poll Votes 10 Poll Votes

Aqui fica a solução, mesmo assim só consegui que apareça depois de lá clicar com o rato em cima, sinceramente não estou a perceber o que está mal. Nem se é incompatibilidade com um load de javascript com estou a usar no site que estou a testar... Aqui fica.

Código: [Seleccione]
<ul>
<li>
<form action="<?php bloginfo('url'?>/wp-login.php" method="post">

<li><label for="log"><input type="text" name="log" id="log" onfocus="if (this.value == 'Utilizador') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Utilizador';}" value="<?php echo wp_specialchars(stripslashes($user_login), 1?>" size="10"  /></label></li>
<li><label for="pwd"><input type="password" name="pwd" id="pwd" size="10" oonfocus="if (this.value == 'Password') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Password';}" /></label></li>
<input type="submit" name="submit" value="Login" class="button" />
<li><label for="rememberme"><input name="rememberme" id="rememberme" type="checkbox" checked="checked" value="forever" /></label></li>

<input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>"/>
</form>


<li><a href="<?php bloginfo('url'?>/wp-register.php">Registar</a> |</li>
<li><a href="<?php bloginfo('url'?>/wp-login.php?action=lostpassword">Recuperar password</a></li>
           
</ul>

<?php endif // get_option('users_can_register') ?>
Offline

Pedro Lopes 
Beta tester
Mensagens 3568 Gostos 18
Feedback +6

Troféus totais: 32
Trófeus: (Ver todos)
Level 6 Windows User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3

Pega neste exemplo - http://stackoverflow.com/questions/1544317/jquery-change-type-of-input-field/2304369#2304369 ;)

O que tens de fazer é criar dois inputs, um com o type de password e o outro de text, depois onfocus esconde um e aparece o outro.