feat(nav): complete remaining zibll parity (search, i18n, senior menus, CSS)
- Remove obsolete dual-path nav CSS; add utilities + language dropdown styles - Wire header/mobile translate switcher from i18n config - Layout-2 inline search hot keywords panel; nav_folding on resize - NavMenuOptions JSON editors for graphic_card / multi_column_links - Section-navs zibll posts-nav-lists; page-navs enqueue; mobile article TOC box - SPA/PHP user-card publish type; rebuild admin assets
This commit is contained in:
1 parent
259dbdbe04
commit
fc50e57bc9
22 files changed
+580
-1994
No files matched your search
@@ -147,3 +147,56 @@ function aksrt_render_language_switcher(string $style = 'dropdown'): string {
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Header language dropdown (zibll zib_get_translate_language_btn).
|
||||
* Uses SPA i18n_available_langs when i18n enabled and position includes header.
|
||||
*
|
||||
* @param string $class Extra classes.
|
||||
*/
|
||||
function aksrt_get_translate_language_btn(string $class = ''): string {
|
||||
if (!class_exists('\AKSRT\Settings\Settings')) {
|
||||
return '';
|
||||
}
|
||||
$cfg = \AKSRT\Settings\Settings::get_i18n_config();
|
||||
if (empty($cfg['enabled'])) {
|
||||
return '';
|
||||
}
|
||||
$pos = (string) ($cfg['switcherPosition'] ?? 'footer');
|
||||
if (!in_array($pos, ['header', 'both'], true)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$raw = (string) ($cfg['availableLangs'] ?? '');
|
||||
$buttons = [];
|
||||
foreach (preg_split('/
|
||||
|␍|
|
||||
/', $raw) as $line) {
|
||||
$line = trim($line);
|
||||
if ($line === '' || strpos($line, '|') === false) {
|
||||
continue;
|
||||
}
|
||||
[$code, $label] = array_map('trim', explode('|', $line, 2));
|
||||
if ($code === '' || $label === '') {
|
||||
continue;
|
||||
}
|
||||
$buttons[] = ['language' => $code, 'text' => $label];
|
||||
}
|
||||
if (!$buttons) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$buttons_html = '';
|
||||
foreach ($buttons as $button) {
|
||||
$buttons_html .= '<li><a href="javascript:;" class="translate-button translate-ignore flex ac" data-language="'
|
||||
. esc_attr($button['language']) . '">' . esc_html($button['text']) . '</a></li>';
|
||||
}
|
||||
$is_mobile = wp_is_mobile();
|
||||
$dropdown = '<ul class="dropdown-menu hover-show-con">' . $buttons_html . '</ul>';
|
||||
$hover = !$is_mobile ? ' hover-show' : '';
|
||||
$toggle = !$is_mobile ? '' : ' data-toggle="dropdown"';
|
||||
return '<div class="dropdown language-dropdown ' . esc_attr($class) . $hover . '">'
|
||||
. '<a href="javascript:;" class="toggle-radius"' . $toggle . ' title="' . esc_attr__('切换语言', 'aksrt') . '">'
|
||||
. '<i class="fas fa-language" aria-hidden="true"></i></a>' . $dropdown . '</div>';
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user