4 Star 57 Fork 3

神秘布偶猫 / iFalse主题

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
comments.php 2.80 KB
一键复制 编辑 原始数据 按行查看 历史
神秘布偶猫 提交于 2023-01-30 22:55 . 1.5.3
<?php
// 评论博主高亮
function filter_get_comment_author( $author, $comment_comment_id, $comment ) {
error_reporting(0);
$blogusers = get_user_by('id', 1);
foreach ( $blogusers as $user ){
if( $author == $user->display_name ){
$webMaster = '<span class="master">'.$author.'</span><i>博主</i>';
return $webMaster;
}
}
return $author;
}
add_filter( 'get_comment_author', 'filter_get_comment_author', 10, 4);
?>
<?php if(comments_open()) { ?>
<div class="post-comments">
<div class="post-comments-content">
<?php comment_form() ?>
<h2 class="post-comments-title">发现<?php if(post_password_required()){echo '已加密';}elseif(comments_open()){comments_popup_link('沙发','1','%');}else{echo '已关闭';} ?>条评论</h2>
<?php wp_list_comments( array(
'avatar_size' => '400',
'type' => 'comment'
));
?>
<?php
if (get_option('page_comments')) {
$comment_pages = paginate_comments_links('echo=0');
if ($comment_pages) {?>
<div id="post-comments-nav">
<?php echo $comment_pages; ?>
</div>
<?php
}
}
?>
</div>
</div>
<?php
if(get_option("i_comments_article") == 1) {
if(get_option("i_comments_turn" ) == 1) {
if(is_user_logged_in() == false) { ?>
<div class="is-logined">
<div class="is-logined-box">
发现您未登录,请先<a href="<?php echo wp_login_url(); ?>">登录</a>后再发表评论!
</div>
</div>
<script>
$('.post-comments #respond > form').remove();
$('.post-comments #respond').append($('.is-logined'));
</script>
<?php }
}
}
} ?>
<script src="<?php echo i_static(); ?>/js/comments.js"></script>
<script>
// 回复时文本域聚焦
const replyText = document.querySelector('.post-comments .comment-respond textarea');
$(document).ready(function() {
if (/replytocom=\d+/.exec(window.location.href)) {
$(replyText).focus();
}
})
</script>
<?php if(get_option("i_plane") != 1) { ?>
<script>
const respond_area = $(`.post-comments .comment-respond textarea,
.post-comments .comment-respond .comment-form-author input,
.post-comments .comment-respond .comment-form-email input,
.post-comments .comment-respond .comment-form-url input`
);
respond_area.focus(function() {
$(this).css('box-shadow','var(--input)');
});
respond_area.blur(function() {
$(this).css('box-shadow','none');
});
</script>
<?php } ?>
PHP
1
https://gitee.com/kannafay/iFalse.git
git@gitee.com:kannafay/iFalse.git
kannafay
iFalse
iFalse主题
master

搜索帮助