轩玮博客演示图:

原版

美化版:

轩玮博客提供部署教程:

教程开始

首先进入网站目录中/wp-content/themes/zibll/inc/functions/zib-comments-list.php找到这个文件搜索zib_widget_comments函数名整段替换为下面的即可

[hidecontent type=”reply” desc=”隐藏内容:评论后查看”]

function zib_widget_comments($limit, $outpost, $outer)
{
    global $wpdb;
    $args = array(
        'orderby' => 'comment_date',
        'number'  => $limit,
        'status'  => 'approve',
        'post_type'=> ['post'],
    );

    if(_pz('bbs_s')){
        $args['post_type'][] = 'forum_post';
    }

    $author__not_in = preg_split("/,|,|\s|\n/", $outer);
    $post__not_in   = preg_split("/,|,|\s|\n/", $outpost);
    if ($author__not_in) {
        $args['author__not_in'] = $author__not_in;
    }
    if ($post__not_in) {
        $args['post__not_in'] = $post__not_in;
    }

    $comments = get_comments($args);

    $output = '';
    foreach ($comments as $comment) {
        $cont  = zib_comment_filters(get_comment_text($comment->comment_ID), 'noimg');
        $_link = get_comment_link($comment->comment_ID);
        $post_title = get_the_title($comment->comment_post_ID); // 获取文章标题
        $post_link = get_permalink($comment->comment_post_ID); // 获取文章链接
        $time      = zib_get_time_ago($comment->comment_date);
        $user_name = get_comment_author($comment->comment_ID);
        $user_id   = $comment->user_id;
        $c_like    = zib_get_comment_like('action action-comment-like pull-right muted-2-color', $comment->comment_ID);
        $vip_icon  = '';

        if ($user_id) {
            $user_name = '<a href="' . zib_get_user_home_url($user_id) . '">' . $user_name . '</a>';
            $user_name = zib_get_user_name('id=' . $user_id . '&level=0&class=inflex ac relative-h');
        }

        $avatar = zib_get_avatar_box($user_id);

        echo '<div class="posts-mini">';
        echo $avatar;
        echo '<div class="posts-mini-con em09 ml10 flex xx jsb mt10">';
        echo '<p class="flex jsb">';
        echo '<span class="flex1 flex">';
        echo $user_name;
        echo '<span class="flex0 icon-spot muted-3-color" title="' . $comment->comment_date . '">' . $time . '</span>';
        echo '</span>';

        echo '<span class="ml10 flex0">' . $c_like . '</span>';
        echo '</p>';
        echo '</div>';
        echo '</div>';
        echo '<div class="mx_comment">';
        echo '<a class="muted-color text-ellipsis-5 muted-box" style="margin:5px" href="' . $_link . '">' . $cont . '</a>';
        echo '<div class="comment-post-link" style="margin:5px; font-size:0.9em;">';
        echo '评论于:<a class="muted-2-color" href="' . $post_link . '" title="' . esc_attr($post_title) . '">' . $post_title . '</a>';
        echo '</div>';
        echo '</div>';
    }
}

 

[/hidecontent]

 

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。