如何在WordPress 4.4中将注释文本字段移到底部

Did you notice that there was a slight change in the comment form fields in WordPress 4.4? The comment textarea is moved to the top whereas the Name, Email, and Website field is moved to the bottom. One of our readers asked if there was a way move back the comment text field to the bottom. Yes, there is because we did it on our site. In this article, we will show you how to move comment text field to the bottom in WordPress 4.4 and later versions.

您是否注意到WordPress 4.4的注释表单字段中有微小变化? 注释文本区域移至顶部,而“名称”,“电子邮件和网站”字段移至底部。 我们的一位读者问是否有办法将注释文本字段移回底部。 是的,这是因为我们是在我们的网站上完成的。 在本文中,我们将向您展示如何在WordPress 4.4和更高版本中将注释文本字段移到底部。

Move comment field to bottom in WordPress 4.4
为什么更改了注释表单文本布局? (Why Comment Form Text Layout Was Changed?)

The decision to move the comment form text field to the bottom was made to fix a bug in WordPress comment form layout.

做出将注释表单文本字段移到底部的决定是为了修复WordPress 注释表单布局中的错误。

Previously when users clicked on reply button they were taken to the comment text area. If a user was on desktop, then they can clearly see that they need to fill in the name and email fields first.

以前,当用户单击“答复”按钮时,他们被带到评论文本区域。 如果用户在桌面上,那么他们可以清楚地看到他们需要首先填写姓名和电子邮件字段。

But on mobile, users may not even see the comment name and email fields. They may write and submit a comment only to return back with an error that they forgot to enter name and email fields.

但是在移动设备上,用户甚至可能看不到评论名称和电子邮件字段。 他们可能会写并提交评论,仅是返回错误而忘记输入姓名和电子邮件字段。

This was bad from usability and accessibility point of view and WordPress 4.4 addressed that issue.

从可用性和可访问性的角度来看,这很糟糕,WordPress 4.4解决了该问题。

This is how the default comment form looks like now.

这是默认注释表单现在的样子。

New comment form layout after WordPress 4.4

While this change improves usability, some site owners believe that their users are used to the old layout and want to switch back. Here is how you can do that.

尽管此更改提高了可用性,但某些网站所有者认为他们的用户已经习惯了旧版式并希望切换回原来的版式。 这是您可以执行的操作。

将注释文本字段移到底部 (Moving the Comment Text Field to Bottom)

Simply add this code snippet in your theme’s functions.php file or in a site-specific plugin.

只需在主题的functions.php文件特定站点的插件中添加此代码段即可。



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' );


That’s all, you can now visit a post on your website as a logged out user and see the change in action.

就是这样,您现在可以以注销用户的身份访问网站上的帖子,并查看操作中的更改。

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

We hope this article helped you move comment text field to the bottom in WordPress 4.4. You may also want to see our guide on how to improve WordPress comments with De:comments.

我们希望本文能帮助您将注释文本字段移至WordPress 4.4的底部。 您可能还想查看我们的指南, 了解如何使用De:comments改进WordPress注释

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在TwitterFacebook上找到我们。

翻译自: https://www.wpbeginner.com/wp-tutorials/how-to-move-comment-text-field-to-bottom-in-wordpress-4-4/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值