Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
Copa WPB
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Como mover o campo de texto do comentário para a parte inferior no WordPress 4.4

Você notou que houve uma pequena alteração nos campos do formulário de comentários no WordPress 4.4? A área de texto do comentário foi movida para a parte superior, enquanto os campos Nome, E-mail e Site foram movidos para a parte inferior. Um de nossos leitores perguntou se havia uma maneira de mover de volta o campo de texto do comentário para a parte inferior. Sim, existe, pois fizemos isso em nosso site. Neste artigo, mostraremos como mover o campo de texto de comentário para a parte inferior no WordPress 4.4 e versões posteriores.

Move comment field to bottom in WordPress 4.4

Por que o layout do texto do formulário de comentário foi alterado?

A decisão de mover o campo de texto do formulário de comentários para a parte inferior foi tomada para corrigir um bug no layout do formulário de comentários do WordPress.

Anteriormente, quando os usuários clicavam no botão de resposta, eles eram levados para a área de texto do comentário. Se o usuário estivesse no desktop, poderia ver claramente que precisava preencher os campos de nome e e-mail primeiro.

Mas no celular, os usuários podem nem ver os campos de nome e e-mail do comentário. Eles podem escrever e enviar um comentário apenas para retornar com um erro informando que esqueceram de inserir os campos de nome e e-mail.

Isso era ruim do ponto de vista da usabilidade e da acessibilidade, e o WordPress 4.4 resolveu esse problema.

Esta é a aparência do formulário de comentário padrão agora.

New comment form layout after WordPress 4.4

Embora essa alteração melhore a usabilidade, alguns proprietários de sites acreditam que seus usuários estão acostumados com o layout antigo e querem voltar a usá-lo. Veja como você pode fazer isso.

Movendo o campo de texto do comentário para a parte inferior

Basta adicionar esse trecho de código no arquivo functions.php do seu tema ou em um plug-in específico do site.


function wpb_move_comment_field_to_bottom( $fields ) {
$comment_field = $fields['comment'];
unset( $fields['comment'] );
$fields['comment'] = $comment_field;
return $fields;
}

add_filter( 'comment_form_fields', 'wpb_move_comment_field_to_bottom' );

Isso é tudo, agora você pode visitar uma publicação no seu site como um usuário desconectado e ver a alteração em ação.

Comparing comment forms before and after moving comment text field to bottom

Esperamos que este artigo tenha ajudado você a mover o campo de texto do comentário para a parte inferior no WordPress 4.4. Talvez você também queira ver nosso guia sobre como melhorar os comentários do WordPress com De:comments.

Se você gostou deste artigo, inscreva-se em nosso canal do YouTube para receber tutoriais em vídeo sobre o WordPress. Você também pode nos encontrar no Twitter e no Facebook.

Divulgação: Nosso conteúdo é apoiado pelo leitor. Isso significa que, se você clicar em alguns de nossos links, poderemos receber uma comissão. Veja como o WPBeginner é financiado, por que isso é importante e como você pode nos apoiar. Aqui está nosso processo editorial.

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

O kit de ferramentas definitivo WordPress

Obtenha acesso GRATUITO ao nosso kit de ferramentas - uma coleção de produtos e recursos relacionados ao WordPress que todo profissional deve ter!

Reader Interactions

38 ComentáriosDeixe uma resposta

  1. Syed Balkhi

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Mariass

    That’s a wonderful post.

    • WPBeginner Support

      Thank you :)

      Administrador

  3. molina

    This is really helpful. thank you so much for sharing with us such an interesting and useful.

  4. wsef

    how to create leave a reply form

  5. Kneema

    Thank you so so much! I’ve been looking for this code for a long time… God bless you

  6. Andres

    Hi there!,

    Thanks so much, I have resolve my problem :)

  7. Aleks

    You know what would be nice, if you could provide an example, how to move comment box above comments. Right now I had to go through entire comments, to write it. I want to switch places. Top > Comments Box. Bottom > Comments. So I don’t need to scroll. I can see that it’s quite easy to do in comments.php, but it’s better if there were a safer way to do so; child theme for instance.

  8. Shamim Mia

    It worked well, thank you so much for sharing the snippet!

  9. Romee Prajapati

    It doesn’t work for me. I am using understrap theme. Can anybody help.

  10. majid

    Thank you for sharing your wealth of knowledge

  11. Ivan Zhotev

    Great snipped. Thanks a lot! Cheers!

  12. Umer Sheikh

    Thank you! It is a useful article.

  13. Leo Nguyen

    Many thanks to you. This is really big help for me.

  14. Susann

    a big thank you for that snippet. Saved me quite some time :-)

  15. Portekoi

    Thanks a lot ! Save my time :)

  16. Abhilash Sharma

    thank you so much

  17. Emily

    You are awesome!!! Thank you!!!

  18. Ruby Ann Rosales

    Works like magic! Thanks :)

  19. Lucas

    Awesome solution to a very aggravating problem. This should be ranked higher for rearranging the comment field order on wordpress. It’s the only link that actually included a WORKING solution.

    Thanks!

    Lucas

  20. Sabin

    Thanks a lot. This was awesome.

    After 2 hours trying to fix it, it took me 1 minute to copy-paste this code. – WP 4.4.2.

  21. Alejandro

    You saved my life, i worked three days trying to fix it thinking it was the theme.

  22. Iman Dastbelaraki

    Thank you very much, very useful article.

  23. Erin Kodama

    Just what I was looking for. Thanks!

  24. Guyom

    Very useful snippet! Thanks a lot for that.

  25. Omid

    It is a useful article, thanks!

  26. moho

    thank you for this tip, I had used a code to automatically approve comments of a specific category but after the last update 4.4 this code not work, do you know how to automatically approve comments in the posts of a specific category?

  27. Mr Darlington

    Really amazing… I just learned a few thing right here.

    awesome article..

  28. Syams

    How to remove website/url coloum?

  29. Simon Lock

    I have been struggling with the comments section for the last 3 days on my wife’s travel blog after it was drawn to my attention that the comments section was not working properly. Of course I had not realized that WordPress had made changes that might impact that area. Seems like the order is now:

    Comment > Write (instead of post > Name > EMail > captcha

    but the more logical order should really be:

    Name > EMail > Website URL (missing right now) > Comment > captcha > Post

    So your article was both timely and appreciated except the code provided does not appear to work with the theme that is currently being used (TeslaThemes ~ Epilog).

    In the theme they provide a place to add custom code but when I pasted in your code nothing changed with the order of the comment fields. Also you show a box for entering a website URL and that does not even show up in the comments area.

    Perhaps you could suggest what is going on – also I was playing around with Jetpack to try and make the comments work and now the home page is screwed up too and is dark brown instead of white. Not sure if this is coming from the Epilog theme or from Jetpack.

    Guidance would definitely be appreciated. URL for the blog was withheld per your policy but can be provided if it is germane to the consideration of this comment.

    Thank you

    Simon

    • Editorial Staff

      Hi Simon,

      I’m not sure about the Epilog theme, but most themes have insert codes area for front-end (i.e HTML / CSS). The code we’re asking you to enter here must be inserted as a site-specific plugin or in your theme’s functions.php file in order for it to work.

      On our site, we have disabled the website field because it attracts a lot of spam.

      More info on that here: https://www.wpbeginner.com/plugins/how-to-remove-website-url-field-from-wordpress-comment-form/

      Administrador

      • Simon Lock

        Thanks for the hints. I could not figure out where to add this code in to Functions.php but while exploring the appearance editor I discovered a file called Comment.php. Although I don’t really understand all the coding I placed your code in what I thought was the appropriate place. I also discovered the “Write” button location and changed that to “Post Your Comment”.

        This successfully moved things around except for the Captcha code created by BestWebSoft. The order now with your code inserted is:

        Name > E-Mail > Captcha > Message > Post Your Comment

        Problem is that I now get an error message “Time Limit is Exhausted. Please enter CAPTCHA value again”

        If I remove the need for a Captcha ie

        Name > E-Mail > Message > Post Your Comment

        then everything works great!!

        Is there some additional code I should add to position the Captcha after the comment block, OR should I just eliminate the need for entering a Captcha.

        If you recommend leaving the Captcha out, what is the downside – do I leave the site vulnerable to spambots or is there some other mechanism of protecting against this?

        Thank you for sharing your wealth of knowledge

        Simon

Deixe uma resposta

Obrigado por deixar um comentário. Lembre-se de que todos os comentários são moderados de acordo com nossos política de comentários, e seu endereço de e-mail NÃO será publicado. NÃO use palavras-chave no campo do nome. Vamos ter uma conversa pessoal e significativa.