diff --git a/assets/css/admin.css b/assets/css/admin.css index fb01efc..4e2abcc 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -312,7 +312,7 @@ } .default-avatar-options input[type="radio"]:checked + img { - border: 2px solid #2271b1; + border: 3px solid #2271b1; border-radius: 50%; } diff --git a/includes/marketing.php b/includes/marketing.php index 9f540af..0480390 100644 --- a/includes/marketing.php +++ b/includes/marketing.php @@ -77,6 +77,15 @@ class Marketing { border: 3px solid #000; z-index: 10; } + .wpavatar-latest-commenters .comment-author-name { + font-size: 12px; + margin-top: 5px; + display: block; + max-width: 90px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } /* 用户头像列表样式 */ .wpavatar-latest-users, @@ -124,6 +133,7 @@ class Marketing { $atts = shortcode_atts([ 'size' => $default_size, 'number' => $default_count, + 'show_names' => 'false' // 新增参数,默认不显示评论者名称 ], $atts, 'wpavatar_latest_commenters'); // 获取全部文章的最新评论,限制为指定的评论者数量 @@ -158,7 +168,15 @@ class Marketing { $avatar_with_link .= ''; // 添加头像到输出 - $output .= '
' . $avatar_with_link . '
'; + $output .= '
'; + $output .= $avatar_with_link; + + // 根据参数决定是否显示评论者名称 + if ($atts['show_names'] === 'true') { + $output .= '' . esc_html($comment->comment_author) . ''; + } + + $output .= '
'; // 记录该评论者,防止重复显示 $seen_emails[] = $comment_email; @@ -183,7 +201,8 @@ class Marketing { $atts = shortcode_atts([ 'number' => $default_count, - 'size' => $default_size + 'size' => $default_size, + 'show_names' => 'true' // 新增参数,控制是否显示用户名 ], $atts); $users = get_users([ @@ -200,7 +219,12 @@ class Marketing { foreach ($users as $user) { $output .= '
'; $output .= get_avatar($user->ID, $atts['size'], '', $user->display_name); - $output .= '
' . esc_html($user->display_name) . '
'; + + // 根据参数决定是否显示用户名 + if ($atts['show_names'] === 'true') { + $output .= '
' . esc_html($user->display_name) . '
'; + } + $output .= '
'; } $output .= ''; @@ -217,7 +241,8 @@ class Marketing { $atts = shortcode_atts([ 'number' => $default_count, - 'size' => $default_size + 'size' => $default_size, + 'show_names' => 'true' // 新增参数,控制是否显示用户名 ], $atts); $args = [ @@ -241,7 +266,12 @@ class Marketing { foreach ($users as $user) { $output .= '
'; $output .= get_avatar($user->ID, $atts['size'], '', $user->display_name); - $output .= '
' . esc_html($user->display_name) . '
'; + + // 根据参数决定是否显示用户名 + if ($atts['show_names'] === 'true') { + $output .= '
' . esc_html($user->display_name) . '
'; + } + $output .= '
'; } $output .= ''; @@ -467,9 +497,10 @@ class Marketing { - [wpavatar_latest_commenters number="10" size="50"] + [wpavatar_latest_commenters number="10" size="50" show_names="true"] [wpavatar_latest_users] @@ -478,9 +509,10 @@ class Marketing { - [wpavatar_latest_users number="12" size="40"] + [wpavatar_latest_users number="12" size="40" show_names="true"] [wpavatar_random_users] @@ -489,9 +521,10 @@ class Marketing { - [wpavatar_random_users number="12" size="40"] + [wpavatar_random_users number="12" size="40" show_names="false"] [wpavatar_author] diff --git a/includes/multisite.php b/includes/multisite.php index bca4e6f..64f3337 100644 --- a/includes/multisite.php +++ b/includes/multisite.php @@ -873,7 +873,7 @@ class Network { flex: 1; min-width: 200px; background: #f9f9f9; - padding: 10px 15px; + padding: 30px; border-radius: 5px; } .option-group h4 { diff --git a/includes/wpcy-compatibility.php b/includes/wpcy-compatibility.php index 92af1bf..eb693db 100644 --- a/includes/wpcy-compatibility.php +++ b/includes/wpcy-compatibility.php @@ -124,7 +124,7 @@ class Compatibility { $screen = get_current_screen(); if ($screen && $screen->id === 'settings_page_wpavatar-settings') { echo '
'; - echo '

检测到文派叶子(WPCY.COM)插件,WPAvatar 生态组件兼容补丁已生效,确保文派头像设置优先。

'; + echo '

检测到文派叶子 🍃(WPCY.COM)插件,WPAvatar 生态组件兼容补丁已生效,确保文派头像设置优先。

'; echo '
'; } } diff --git a/wpavatar.php b/wpavatar.php index 2d5a0d6..7fbfecb 100644 --- a/wpavatar.php +++ b/wpavatar.php @@ -1,7 +1,7 @@