加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
comments.php 2.65 KB
一键复制 编辑 原始数据 按行查看 历史
唐杰 提交于 2021-06-23 01:31 . 清理冗余参数
<?php
if ( post_password_required() )
return;
?>
<?php if ( have_comments() ) : ?>
<div class="comment-head clearfix">
<div class="pull-left"><?php comments_number(__('没有评论','1条评论','%条评论'));?></div>
<div class="pull-right"><a href="#respond"><i class="far fa-paper-plane"></i> 发表新评论</a></div>
</div>
<ul>
<?php wp_list_comments( array( 'callback' => 'tangstyle_comment', 'style' => 'ol' ) ); ?>
</ul>
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
<nav id="comment-nav-below">
<ul class="pager">
<li><?php previous_comments_link( __( '上一页', 'tangstyle' ) ); ?></li>
<li><?php next_comments_link( __( '下一页', 'tangstyle' ) ); ?></li>
</ul>
</nav>
<?php endif; ?>
<?php elseif ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
<p><?php _e( '评论已关闭!', 'tangstyle' ); ?></p>
<?php endif; ?>
<?php
$fields = array(
'author' => '<div class="comment-form-author form-group has-feedback"><div class="input-group"><div class="input-group-addon"><i class="fas fa-user"></i></div><input class="form-control" placeholder="昵称" id="author" name="author" type="text" value="" ' . esc_attr( $commenter['comment_author'] ) . '" size="30" /><span class="form-control-feedback required">*</span></div></div>',
'email' => '<div class="comment-form-email form-group has-feedback"><div class="input-group"><div class="input-group-addon"><i class="fas fa-envelope"></i></div><input class="form-control" placeholder="邮箱" id="email" name="email" type="text" value="" ' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" /><span class="form-control-feedback required">*</span></div></div>',
'url' => '<div class="comment-form-url form-group has-feedback"><div class="input-group"><div class="input-group-addon"><i class="fas fa-link"></i></div><input class="form-control" placeholder="网站" id="url" name="url" type="text" value="" ' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></div></div>',
);
$args = array(
'title_reply_before' => '<h4 id="reply-title" class="comment-reply-title">',
'title_reply_after' => '</h4>',
'fields' => $fields,
'class_submit' => 'btn btn-primary',
'comment_field' => '<div class="comment form-group has-feedback"><textarea class="form-control" id="comment" placeholder=" " name="comment" rows="5" aria-required="true" required onkeydown="if(event.ctrlKey){if(event.keyCode==13){document.getElementById(\'submit\').click();return false}};"></textarea></div>',
);
comment_form($args);
?>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化