我正在使用wordpress为一些治疗师建立一个网站,并使用帖子的评论部分与治疗师进行问答。但是,我在"发表评论"按钮上找不到文本的来源。我想将其更改为"发布问题"。
主题中的评论.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(__( '‹ previous','pilotfish' )); ?></div><!-- end of .previous -->
<div class="next"><?php next_comments_link(__( 'next ›','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; ?>
注释表单 Codex 包含您需要了解的有关自定义注释表单值的所有信息。
$defaults = array(
'fields' => apply_filters('comment_form_default_fields', $fields),
'label_submit' => __('Post a Question')
);
comment_form($defaults);
这应该可以满足您的需求。
避免直接编辑主题的文件,因为更新主题时可能会覆盖所做的更改。
function change_comment_form_submit_label($arg) {
$arg['label_submit'] = 'Post a Question';
return $arg;
}
add_filter('comment_form_defaults', 'change_comment_form_submit_label', 11);
我添加了优先级 11,因为默认值为 10,您的主题可能会使用默认优先级更改它。
注释表单 Codex 包含您需要了解的有关自定义注释表单值的所有信息。
输入的值设置为 <input value="Post a question">
只需搜索文本post comment
并更改其button
标签的value
,
<input name="submit" type="submit" id="submit" value="Post a Question">
更改以下input
元素的value
属性:
<input type="submit" value="Post a Question" id="submit" name="submit">
如果您搜索所有文件以查找"发表评论",您应该找到所需的内容。
在类下form-submit
更改值。
以前
...
<p class="form-submit">
<input id="submit" type="submit" value="Post Comment" name="submit">
...
更改为
...
<p class="form-submit">
<input id="submit" type="submit" value="Post A Question" name="submit">
...