我正在开发一个WordPress主题的评论部分,下面是评论中的代码。php:
<div class="comments">
<h2>Comments</h2>
<?php $args = array(
\'walker\' => null,
\'max_depth\' => \'\',
\'style\' => \'ul\',
\'callback\' => null,
\'end-callback\' => null,
\'type\' => \'all\',
\'reply_text\' => \'Reply\',
\'page\' => \'\',
\'per_page\' => \'\',
\'avatar_size\' => 80,
\'reverse_top_level\' => null,
\'reverse_children\' => \'\',
\'format\' => \'html5\', // or \'xhtml\' if no \'HTML5\' theme support
\'short_ping\' => false, // @since 3.6
\'echo\' => true // boolean, default is true
);
?>
<?php wp_list_comments($args, $comments); ?>
<?php
$form_args = array(
\'label_submit\' => \'Send\',
\'title_reply\' => \'Write a Reply or Comment\',
\'comment_notes_after\' => \'\',
\'comment_field\' => \'<p class="comment-form-comment"><label for="comment">\'._x(\'Comment\',\'noun\').\'</label><br /><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>\',
);
comment_form($forms_args);
?>
</div>
您是否看到了在$form\\u args数组“label\\u submit”=>“Send”下的方式。但是,它仍在浏览器上呈现默认值,即“发表评论”。我尝试了不同的方法,但我似乎无法让我的“发送”覆盖“发表评论”。
SO网友:Daniel
我进一步研究了WordPress Codex,并分析了我在这里发布的代码,如果你看顶部,上面写着$form\\u args,但在comment\\u form($forms\\u args):
<?php
$form_args = array(
\'label_submit\' => \'Send\',
\'title_reply\' => \'Write a Reply or Comment\',
\'comment_notes_after\' => \'\',
\'comment_field\' => \'<p class="comment-form-comment"><label for="comment">\'._x(\'Comment\',\'noun\').\'</label><br /><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>\',
);
comment_form($forms_args);
?>
因此,我只需要将s从我传递到comment\\u表单的内容中删除:
<?php
$form_args = array(
\'label_submit\' => \'Send\',
\'title_reply\' => \'Write a Reply or Comment\',
\'comment_notes_after\' => \'\',
\'comment_field\' => \'<p class="comment-form-comment"><label for="comment">\'._x(\'Comment\',\'noun\').\'</label><br /><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>\',
);
comment_form($form_args);