fix(header): use single adaptive logo like Zibll

Replace dual light/dark header images with one img carrying white-src
and dark-src so theme.js swaps src; keep size rules and legacy hide
classes as fallback.
This commit is contained in:
2026-07-13 07:55:39 +08:00
parent 1e37da60c9
commit 9c19bc250d
2 changed files with 27 additions and 9 deletions
+10 -8
View File
@@ -170,15 +170,17 @@ if (!empty($aksrt_bg_styles)) {
$aksrt_nav_styles[] = '--nav-max-width:' . (int) $aksrt_header_settings['max_width'] . 'px';
}
$aksrt_logo_parts = [];
if ($aksrt_logo_url !== '') {
$aksrt_logo_parts[] = '<img class="site-brand__logo-img site-brand__logo-img--light" src="' . esc_url($aksrt_logo_url) . '" alt="' . esc_attr($aksrt_brand_name) . '"' . ($aksrt_logo_width > 0 ? ' style="height:36px;width:auto;max-width:' . max(36, (int) $aksrt_logo_width) . 'px"' : '') . '>';
$aksrt_brand_logo_src = $aksrt_logo_url;
}
if ($aksrt_logo_dark_url !== '') {
$aksrt_logo_parts[] = '<img class="site-brand__logo-img site-brand__logo-img--dark" src="' . esc_url($aksrt_logo_dark_url) . '" alt="' . esc_attr($aksrt_brand_name) . '"' . ($aksrt_logo_width > 0 ? ' style="height:36px;width:auto;max-width:' . max(36, (int) $aksrt_logo_width) . 'px"' : '') . '>';
if ($aksrt_brand_logo_src === '') {
$aksrt_brand_logo_src = $aksrt_logo_dark_url;
if ($aksrt_logo_url !== '' || $aksrt_logo_dark_url !== '') {
$aksrt_logo_more = $aksrt_logo_width > 0
? 'style="height:36px;width:auto;max-width:' . max(36, (int) $aksrt_logo_width) . 'px"'
: 'style="height:36px;width:auto"';
$aksrt_logo_html = function_exists('aksrt_get_adaptive_theme_img')
? aksrt_get_adaptive_theme_img($aksrt_logo_url, $aksrt_logo_dark_url, $aksrt_brand_name, $aksrt_logo_more)
: '';
if ($aksrt_logo_html !== '') {
$aksrt_logo_parts[] = $aksrt_logo_html;
}
$aksrt_brand_logo_src = $aksrt_logo_url !== '' ? $aksrt_logo_url : $aksrt_logo_dark_url;
}
$aksrt_has_brand_logo = !empty($aksrt_logo_parts);
if ($aksrt_has_brand_logo) {