Skip to content

Commit

Permalink
🐛 修复关于在WP讨论设置中[关闭头像显示]适配 #76
Browse files Browse the repository at this point in the history
  • Loading branch information
Licoy committed Jul 21, 2021
1 parent de499a6 commit 75c7573
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions inc/fun/comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ function pk_comment_callback($comment, $args, $depth) {

<div id="comment-<?php comment_ID() ?>" class="post-comment">
<div class="info clearfix">
<?php if(pk_open_show_comment_avatar()):?>
<div class="float-left">
<?php if(pk_is_checked('basic_img_lazy_a')): ?>
<img src="<?php echo pk_get_lazy_pl_img() ?>" data-src="<?php echo get_avatar_url( $comment->comment_author_email, 64); ?>"
Expand All @@ -24,7 +25,8 @@ class="avatar avatar-64 photo md-avatar lazyload" width="60" height="60">
<?php echo get_avatar( $comment, 64,'','',array('class'=>'md-avatar') ) ?>
<?php endif; ?>
</div>
<div class="float-left ml-3 two-info">
<?php endif; ?>
<div class="float-left <?php if(pk_open_show_comment_avatar()){echo 'ml-3';}?> two-info">
<div class="puock-text ta3b">
<span class="t-md puock-links"><?php pk_comment_author_url() ?></span>
<?php if(pk_is_checked('comment_level')){pk_the_author_class();} ?>
Expand All @@ -41,7 +43,7 @@ class="hide-info animated bounceIn c-sub-a t-sm ml-1 comment-reply"
</div>
</div>
<div class="content">
<div class="content-text t-sm mt10 puock-text">
<div class="content-text t-sm mt10 puock-text" <?php if(!pk_open_show_comment_avatar()){echo 'style="margin-left:0"';} ?>>
<?php if(!$author_cat_comment || $is_author): comment_text(); ;else:?>
<?php echo "<span><i class='czs-lock-l'></i>&nbsp;此评论仅对作者可见</span>";endif; ?>
<?php if ( $comment->comment_approved == '0' ) : ?>
Expand Down
5 changes: 5 additions & 0 deletions inc/fun/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -816,4 +816,9 @@ function pk_get_static_url(){
default: $url_pre = get_template_directory_uri();
}
return $url_pre;
}

//是否打开讨论-显示头像
function pk_open_show_comment_avatar(){
return get_option('show_avatars') == "1";
}

0 comments on commit 75c7573

Please sign in to comment.