feat(nav): deep 1:1 zibll search-box + navbar-search + newposts unify
Port aksrt_get_search_box/posts for menu_search and layout 1/3 slide; unify publish switch; expand user-box admin row; CSS/JS remote-box parity.
This commit is contained in:
1 parent
70f7ef71e1
commit
1d1fef50af
19 files changed
+980
-267
No files matched your search
@@ -77,7 +77,7 @@ if (!function_exists('aksrt_navbar_header')) :
|
||||
$button .= '<i class="em12 css-icon i-menu"><i></i></i></button>';
|
||||
|
||||
if (($ctx['mobile_layout'] ?? 'center') === 'center' && !empty($ctx['search_enabled'])) {
|
||||
$button .= '<button type="button" class="navbar-toggle main-search-btn nav-search-btn" data-toggle-class data-target=".navbar-search" aria-label="'
|
||||
$button .= '<button type="button" class="navbar-toggle main-search-btn nav-search-btn" data-toggle-class="show" data-target=".navbar-search" aria-label="'
|
||||
. esc_attr__('打开搜索', 'aksrt') . '">';
|
||||
$button .= '<i class="fas fa-search" aria-hidden="true"></i></button>';
|
||||
}
|
||||
@@ -100,33 +100,27 @@ if (!function_exists('aksrt_get_menu_search')) :
|
||||
return;
|
||||
}
|
||||
$placeholder = (string) ($ctx['search_placeholder'] ?? __('搜索内容', 'aksrt'));
|
||||
$state = is_array($ctx['search_state'] ?? null) ? $ctx['search_state'] : [];
|
||||
$type = (string) ($state['type'] ?? 'post');
|
||||
$cat_enabled = !empty($state['category_enabled']);
|
||||
$cat_id = (int) ($state['category_id'] ?? 0);
|
||||
|
||||
// zibll remote-box: panel HTML loaded via ajax action menu_search.
|
||||
$remote_url = add_query_arg(
|
||||
[
|
||||
'action' => 'aksrt_menu_search',
|
||||
],
|
||||
admin_url('admin-ajax.php')
|
||||
);
|
||||
|
||||
// zibll: form + input + remote-box (action=menu_search).
|
||||
echo '<form method="get" class="navbar-form navbar-left hover-show" action="' . esc_url(home_url('/')) . '" role="search" data-aksrt-search-form="inline">';
|
||||
echo '<div class="form-group relative dropdown">';
|
||||
echo '<input type="hidden" name="aksrt_search_type" value="' . esc_attr($type) . '">';
|
||||
if ($cat_enabled) {
|
||||
echo '<input type="hidden" name="aksrt_category" value="' . esc_attr((string) $cat_id) . '">';
|
||||
}
|
||||
echo '<input type="text" class="form-control search-input focus-show" name="s" value="'
|
||||
. esc_attr(get_search_query()) . '" placeholder="' . esc_attr($placeholder) . '" autocomplete="off">';
|
||||
echo '<div class="abs-right muted-3-color"><button type="submit" class="null" aria-label="'
|
||||
. esc_attr__('搜索', 'aksrt') . '"><i class="fas fa-search" aria-hidden="true"></i></button></div>';
|
||||
// Remote panel mount (zibll remote-box / lazyload-action=ias).
|
||||
echo '<div class="aksrt-remote-box lazyload" remote-box="' . esc_url($remote_url) . '" lazyload-action="ias" data-aksrt-menu-search-remote="1">';
|
||||
echo '<i class="loading-spot"><i></i></i>';
|
||||
echo '</div>';
|
||||
if (function_exists('aksrt_get_remote_box')) {
|
||||
echo aksrt_get_remote_box([ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
'class' => '',
|
||||
'loader' => ' ',
|
||||
'query' => [
|
||||
'action' => 'menu_search',
|
||||
],
|
||||
]);
|
||||
} else {
|
||||
$remote_url = add_query_arg(['action' => 'menu_search'], admin_url('admin-ajax.php'));
|
||||
echo '<div class="lazyload" remote-box="' . esc_url($remote_url) . '" lazyload-action="ias">';
|
||||
echo '<i class="loading-spot"><i></i></i></div>';
|
||||
}
|
||||
echo '</div></form>';
|
||||
}
|
||||
endif;
|
||||
@@ -224,6 +218,17 @@ if (!function_exists('aksrt_header_user_box_html')) :
|
||||
$href .= '<a rel="nofollow" target="_blank" href="' . esc_url((string) $ctx['theme_settings_url']) . '">';
|
||||
$href .= '<div class="badg mb6 toggle-radius c-yellow"><i class="fas fa-sliders-h" aria-hidden="true"></i></div>';
|
||||
$href .= '<div class="c-yellow">' . esc_html__('主题设置', 'aksrt') . '</div></a>';
|
||||
// zibll: 模块布局 → widgets.
|
||||
$href .= '<a rel="nofollow" target="_blank" href="' . esc_url(admin_url('widgets.php')) . '">';
|
||||
$href .= '<div class="badg mb6 toggle-radius c-yellow"><i class="fas fa-chart-pie" aria-hidden="true"></i></div>';
|
||||
$href .= '<div class="c-yellow">' . esc_html__('模块布局', 'aksrt') . '</div></a>';
|
||||
// zibll: 商城中心.
|
||||
$shop_url = post_type_exists('aksrt_product')
|
||||
? admin_url('edit.php?post_type=aksrt_product')
|
||||
: admin_url('admin.php?page=aksrt_pay');
|
||||
$href .= '<a rel="nofollow" target="_blank" href="' . esc_url($shop_url) . '">';
|
||||
$href .= '<div class="badg mb6 toggle-radius c-yellow"><i class="fas fa-shopping-bag" aria-hidden="true"></i></div>';
|
||||
$href .= '<div class="c-yellow">' . esc_html__('商城中心', 'aksrt') . '</div></a>';
|
||||
$href .= '<a rel="nofollow" target="_blank" href="' . esc_url(admin_url()) . '">';
|
||||
$href .= '<div class="badg mb6 toggle-radius c-yellow"><i class="fas fa-cog" aria-hidden="true"></i></div>';
|
||||
$href .= '<div class="c-yellow">' . esc_html__('后台管理', 'aksrt') . '</div></a>';
|
||||
@@ -346,7 +351,7 @@ if (!function_exists('aksrt_menu_button')) :
|
||||
|
||||
$search_but = '';
|
||||
if ('2' !== $layout && !empty($ctx['search_enabled'])) {
|
||||
$search_but = '<li class="relative"><a href="javascript:;" class="btn nav-search-btn main-search-btn" data-toggle-class data-target=".navbar-search" aria-label="'
|
||||
$search_but = '<li class="relative"><a href="javascript:;" class="btn nav-search-btn main-search-btn" data-toggle-class="show" data-target=".navbar-search" aria-label="'
|
||||
. esc_attr__('打开搜索', 'aksrt') . '"><i class="fas fa-search" aria-hidden="true"></i></a></li>';
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user