加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
comments.php 3.38 KB
一键复制 编辑 原始数据 按行查看 历史
Seaton Jiang 提交于 2020-03-14 09:16 . chore: add missing translations
<?php
/**
* 评论模板
* @author Seaton Jiang <seaton@vtrois.com>
* @license MIT License
* @version 2020.03.14
*/
if (isset($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME'])) {
die();
}
require get_template_directory() . '/pages/page-smilies.php';
if (comments_open()) {?>
<div class="comments" id="comments">
<h3 class="title"><?php if (is_single()) {_e('文章评论', 'kratos');} else {_e('评论内容', 'kratos');}?></h3>
<div class="list">
<?php wp_list_comments('type=comment&callback=comment_callbacks');?>
</div>
<div id="commentpage" class="nav text-center my-3">
<?php previous_comments_link(__('加载更多', 'kratos'));?>
</div>
<div id="respond" class="comment-respond mt-2">
<?php if (!comments_open()): elseif (get_option('comment_registration') && !is_user_logged_in()): ?>
<div class="error text-center">
<?php printf(__('您需要 <a href="%s">登录</a> 之后才可以评论', 'kratos'), wp_login_url(get_permalink()));?>
</div>
<?php else: ?>
<form id="commentform" name="commentform" action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post">
<div class="comment-form">
<?php if (!is_user_logged_in()): ?>
<div class="comment-info mb-3 row">
<div class="col-md-6 comment-form-author">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="kicon i-user"></i></span>
</div>
<input class="form-control" id="author" placeholder="<?php _e('昵称', 'kratos'); ?>" name="author" type="text" value="<?php echo esc_attr($commenter['comment_author']); ?>" required="required">
</div>
</div>
<div class="col-md-6 mt-3 mt-md-0 comment-form-email">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="kicon i-cemail"></i></span>
</div>
<input id="email" class="form-control" name="email" placeholder="<?php _e('邮箱', 'kratos'); ?>" type="email" value="<?php echo esc_attr($commenter['comment_author_email']); ?>" required="required">
</div>
</div>
<div class="col-md-6 mt-3 comment-form-author">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="kicon i-url"></i></span>
</div>
<input class="form-control" id="author" placeholder="<?php _e('网址', 'kratos'); ?>" name="url" type="url" value="<?php echo esc_attr($commenter['comment_author_url']); ?>">
</div>
</div>
</div>
<?php endif;?>
<div class="comment-textarea">
<textarea class="form-control" id="comment" name="comment" rows="7" required="required"></textarea>
<div class="text-bar clearfix">
<div class="tool float-left">
<a class="addbtn" href="#" id="addsmile"><i class="kicon i-face"></i></a>
<div class="smile">
<div class="clearfix">
<?php echo $smilies; ?>
</div>
</div>
</div>
<div class="float-right">
<?php cancel_comment_reply_link(__('取消回复', 'kratos'));?>
<input name="submit" type="submit" id="submit" class="btn btn-primary" value="<?php _e('提交评论', 'kratos');?>">
</div>
</div>
</div>
</div>
<?php comment_id_fields();?>
<?php do_action('comment_form', $post->ID);?>
</form>
<?php endif;?>
</div>
</div>
<?php }?>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化