php - 如何更改 "post comment"按钮上的文本?

标签 php html wordpress

我正在使用 wordpress 为一些治疗师建立一个网站,并使用帖子的评论部分与治疗师进行问答。但是我无法在“发表评论”按钮上找到文本的来源。我想将其更改为“发布问题”。

主题中的 comments.php 没有任何内容,我在主 wp-comments-post.php 中的任何地方都找不到它

任何帮助都会很棒!

谢谢

网址是http://s416809079.onlinehome.us/ask-the-therapist/

编辑:我的困惑是我在任何地方都找不到“发表评论”。另外,如果我只是添加它,那么就会变成两个按钮,而新按钮实际上不会提交。这是代码。

<?php
/**
 * Comments Template
 *
 * @file           comments.php
 * @package        Pilot Fish
 * @filesource     wp-content/themes/pilot-fish/comments.php
 * @since          Pilot Fish 0.1
 */
if ( post_password_required() ) : ?>
<p class="nocomments"><?php _e( 'This post is password protected. Enter the password to view any comments.', 'pilotfish' ); ?></p>
<?php /* Stop the rest of comments.php from being processed */
        return;
endif; ?>

<?php if (have_comments()) : ?>
<h6 id="comments"><?php comments_number(__('No Response to', 'pilotfish'), __('One Response to', 'pilotfish'), __('% Responses to', 'pilotfish')); ?> <i><?php the_title(); ?></i></h6>

<ol class="commentlist">
    <?php wp_list_comments('avatar_size=60'); ?> 
</ol>

<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
<nav class="pager">
    <div class="previous"><?php previous_comments_link(__( '&#8249; previous','pilotfish' )); ?></div><!-- end of .previous -->
    <div class="next"><?php next_comments_link(__( 'next &#8250;','pilotfish', 0 )); ?></div><!-- end of .next -->
</nav><!-- end of.pager -->
<?php endif; ?>

<?php else : ?>
<?php if (comments_open()) : ?>

<?php
$fields = array(
    'author' => '<p id="comment-form-author">' . '<label for="author">' .     __('Name','pilotfish') . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) .
    '<input id="author" name="author" placeholder="'. __('name (required)', 'pilotfish').'" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30" /></p>',
    'email' => '<p id="comment-form-email"><label for="email">' . __('E-mail','pilotfish') . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) .
    '<input id="email" name="email" placeholder="'. __('email (required)', 'pilotfish').'" type="text" value="' . esc_attr($commenter['comment_author_email']) . '" size="30" /></p>',
    'url' => '<p id="comment-form-url"><label for="url">' . __('Website','pilotfish') . '</label>' .
    '<input id="url" name="url" placeholder="'. __('website', 'pilotfish').'" type="text" value="' . esc_attr($commenter['comment_author_url']) . '" size="30" /></p>',
);
$defaults = array('fields' => apply_filters('comment_form_default_fields', $fields));
comment_form($defaults);


?>
<?php endif; ?>

最佳答案

Comment Form Codex包含您需要了解的有关自定义评论表单值的所有信息。

$defaults = array(
    'fields' => apply_filters('comment_form_default_fields', $fields),
    'label_submit' => __('Post a Question')
);
comment_form($defaults);

这应该可以满足您的需求。

关于php - 如何更改 "post comment"按钮上的文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12828181/

相关文章:

php - 防止 php 类被扩展

php - 传递 PHP 对象以在外部 JS 脚本中使用

html - 将 padding-left 和 padding-right 设置为元素宽度的 10%

javascript - Wordpress:我的 JS 文件没有执行任何代码,也没有返回 404 错误

php - 无法建立连接,因为目标机器主动拒绝

php - 如何按键查找最大和最小日期

Javascript 函数立即触发自身

javascript - 单击该元素时获取 li 元素文本

reactjs - 是否可以在同一域下使用 Next.js 和 WordPress 页面?

wordpress - 访问 WordPress 管理面板时被禁止