修复了一些问题

This commit is contained in:
kate522 committed 2026-08-25 18:31:49 +08:00
1 parent c8d199a694
commit 3dbd196e06
9 files changed
+99 -25

No files matched your search

+18 -3
View File
@@ -173,9 +173,10 @@ if (!function_exists('aksrt_header_user_box_html')) :
$badges = function_exists('aksrt_header_user_badges_row') ? aksrt_header_user_badges_row($user_id) : '';
$unread = (int) ($ctx['unread_count'] ?? 0);
$msg_url = (string) ($ctx['messages_url'] ?? '');
$positions = (array) ($ctx['message_icon_positions'] ?? []);
$msg_icon = '';
if ($msg_url !== '') {
if ($msg_url !== '' && in_array('avatar_dropdown', $positions, true)) {
$msg_icon = '<a class="abs-right" href="' . esc_url($msg_url) . '" title="' . esc_attr__('消息中心', 'aksrt') . '">';
$msg_icon .= '<i class="fa fas fa-bell" aria-hidden="true"></i>';
if ($unread > 0) {
@@ -304,7 +305,21 @@ if (!function_exists('aksrt_menu_button')) :
$utility_buttons .= aksrt_get_translate_language_btn('aksrt-navbar-language');
}
// User + search.
// Notifications, user and search.
$notification_but = '';
$messages_url = (string) ($ctx['messages_url'] ?? '');
$positions = (array) ($ctx['message_icon_positions'] ?? []);
if ($user_id > 0 && $messages_url !== '' && in_array('nav_menu', $positions, true)) {
$unread = (int) ($ctx['unread_count'] ?? 0);
$notification_but = '<li class="relative"><a rel="nofollow" href="' . esc_url($messages_url)
. '" class="aksrt-nav-icon aksrt-nav-notification" aria-label="' . esc_attr__('消息中心', 'aksrt') . '">'
. '<i class="fa fas fa-bell" aria-hidden="true"></i>';
if ($unread > 0) {
$notification_but .= '<span class="aksrt-notification-badge">' . esc_html((string) min(99, $unread)) . '</span>';
}
$notification_but .= '</a></li>';
}
$sign_but = '';
$user_sub = '<div class="padding-10">' . aksrt_header_user_box_html($ctx) . '</div>';
if ('2' === $layout) {
@@ -333,7 +348,7 @@ if (!function_exists('aksrt_menu_button')) :
$account = '<ul class="list-inline splitters relative aksrt-navbar-account'
. ($user_id <= 0 && '2' === $layout ? ' navbar-text' : '') . '">'
. $sign_but . $search_but . '</ul>';
. $notification_but . $sign_but . $search_but . '</ul>';
$button = '<div class="aksrt-navbar-actions navbar-form navbar-right">'
. $actions . $utility_buttons . $account . '</div>';
+5 -1
View File
@@ -68,6 +68,9 @@ if (!function_exists('aksrt_get_header_nav_context')) :
$current_user = wp_get_current_user();
$user_id = (int) $current_user->ID;
$user_desc = $user_id > 0 && function_exists('aksrt_get_user_description') ? aksrt_get_user_description($user_id) : '';
$notification_settings = class_exists('\AKSRT\Settings\Settings')
? \AKSRT\Settings\Settings::notification_settings()
: ['enabled' => false, 'icon_show' => []];
$ctx = [
'settings' => $settings,
@@ -88,7 +91,8 @@ if (!function_exists('aksrt_get_header_nav_context')) :
'unread_count' => ($user_id > 0 && function_exists('aksrt_get_user_unread_notification_count'))
? (int) aksrt_get_user_unread_notification_count($user_id)
: 0,
'messages_url' => function_exists('aksrt_get_messages_page_url') ? aksrt_get_messages_page_url() : '',
'message_icon_positions' => (array) ($notification_settings['icon_show'] ?? []),
'messages_url' => !empty($notification_settings['enabled']) && function_exists('aksrt_get_messages_page_url') ? aksrt_get_messages_page_url() : '',
'orders_url' => function_exists('aksrt_get_user_center_tab_url') ? aksrt_get_user_center_tab_url('orders') : '',
'publish_url' => function_exists('aksrt_get_new_post_url') ? aksrt_get_new_post_url() : admin_url('post-new.php'),
'theme_settings_url' => function_exists('aksrt_get_admin_settings_url')