diff --git a/assets/css/frontend/widget-batch5.css b/assets/css/frontend/widget-batch5.css index b8e2befd..ccb27575 100644 --- a/assets/css/frontend/widget-batch5.css +++ b/assets/css/frontend/widget-batch5.css @@ -539,3 +539,16 @@ background: var(--surface-2, #e5e7eb); color: inherit !important; } + +.aksrt-author-card__badge { + display: inline-flex; + align-items: center; + gap: 4px; + margin-top: 8px; + padding: 2px 10px; + border-radius: 999px; + font-size: 12px; + background: #fef3c7; + color: #b45309; +} +.aksrt-author-card__badge img { border-radius: 50%; } diff --git a/src/AKSRT/Widgets/WidgetAuthorCard.php b/src/AKSRT/Widgets/WidgetAuthorCard.php index 9796f015..6a523eda 100644 --- a/src/AKSRT/Widgets/WidgetAuthorCard.php +++ b/src/AKSRT/Widgets/WidgetAuthorCard.php @@ -85,6 +85,28 @@ class WidgetAuthorCard extends \WP_Widget { if ($bio !== '') { echo '
'; } + $show_badge = !isset($instance['show_badge']) || !empty($instance['show_badge']); + if ($show_badge && class_exists('\AKSRT\User\Badges') && \AKSRT\User\Badges::public_display()) { + $wear = \AKSRT\User\Badges::get_wear($author_id); + if ($wear === '') { + // zibll alias fallback + $wear = sanitize_key((string) get_user_meta($author_id, 'wear_medal', true)); + } + if ($wear !== '') { + $map = \AKSRT\User\Badges::get_dictionary_map(); + if (isset($map[$wear])) { + $badge = $map[$wear]; + echo ''; + } + } + } if ($show_stats) { echo '