如何在wordpress中更改注释表单中字段的顺序

如何在wordpress中更改注释表单中字段的顺序,wordpress,Wordpress,我目前使用的是标志性的一个主题(WordPress)。 奇怪的是,电子邮件字段首先出现在评论表单中。 我试图通过引用来更改“author”和“email”之间字段的顺序,但我做不到 如何在wordpress评论系统中切换电子邮件和作者字段的顺序?您是否尝试过查看不同的论坛 试着看看这个: 使用以下过滤器更改字段顺序- add_filter( 'comment_form_defaults', 't5_move_textarea' ); add_action( 'comment_form_top'

我目前使用的是标志性的一个主题(WordPress)。 奇怪的是,电子邮件字段首先出现在评论表单中。

我试图通过引用来更改“author”和“email”之间字段的顺序,但我做不到


如何在wordpress评论系统中切换电子邮件和作者字段的顺序?

您是否尝试过查看不同的论坛

试着看看这个:


使用以下过滤器更改字段顺序-

add_filter( 'comment_form_defaults', 't5_move_textarea' );
add_action( 'comment_form_top', 't5_move_textarea' );

function t5_move_textarea( $input = array () )
{
    static $textarea = '';

    if ( 'comment_form_defaults' === current_filter() )
    {
        // Copy the field to our internal variable …
        $textarea = $input['comment_field'];
        // … and remove it from the defaults array.
        $input['comment_field'] = '';
        return $input;
    }

    print apply_filters( 'comment_form_field_comment', $textarea );
}
$fields=数组(
“作者”=>
“

.”(“Name”,“domainreference”)。”。 ($req?'*':'')。 “

”, “电子邮件”=> “

.”(“email”,“domainreference”)。 ($req?'*':'')。 “

”, “url”=> “

.”(“网站”、“域引用”)。 “

”, );

这应该会像你说的那样改变它。如果不起作用,你可能会在某个地方覆盖你正在使用的主题,或者你可以尝试删除该字段并添加你自己的主题。

谢谢你的回答。
$fields =  array(

  'author' =>
    '<p class="comment-form-author"><label for="author">' . __( 'Name', 'domainreference' ) . '</label> ' .
    ( $req ? '<span class="required">*</span>' : '' ) .
    '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) .
    '" size="30"' . $aria_req . ' /></p>',

  'email' =>
    '<p class="comment-form-email"><label for="email">' . __( 'Email', 'domainreference' ) . '</label> ' .
    ( $req ? '<span class="required">*</span>' : '' ) .
    '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) .
    '" size="30"' . $aria_req . ' /></p>',

  'url' =>
    '<p class="comment-form-url"><label for="url">' . __( 'Website', 'domainreference' ) . '</label>' .
    '<input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) .
    '" size="30" /></p>',
);