feat(nav): deep-align menu_search panel, pill radius, senior media

- Layout-2 remote-box AJAX panel (history/hot/posts) via aksrt_menu_search
- Live suggestions for post/topic/product; local history for guests
- Publish radius switch (zibll bool pill) mapped to CSS radius class
- Senior menu editor: WP media library image picker
- Active menu underline + panel CSS; acceptance/contract updates
This commit is contained in:
2026-07-22 12:51:56 +08:00
parent 2a11a889c3
commit 159a12c481
14 changed files with 494 additions and 117 deletions
+1
View File
@@ -25,6 +25,7 @@ class NavMenuOptions {
if (!file_exists($path)) {
return;
}
wp_enqueue_media();
wp_enqueue_script(
'aksrt-admin-nav-menu-senior',
get_template_directory_uri() . '/assets/js/admin-nav-menu-senior.js',
+1 -1
View File
@@ -50,7 +50,7 @@ class SchemaPageDisplay {
['key' => 'newposts', 'title' => '发布按钮', 'fields' => [
['key' => 'header_newposts_enabled', 'label' => '启用发布按钮', 'type' => 'switch', 'default' => true],
['key' => 'header_newposts_text', 'label' => '按钮文案', 'type' => 'input', 'default' => '<i class="fa fa-pencil"></i> 发布'],
['key' => 'header_newposts_radius', 'label' => '圆角', 'type' => 'number', 'default' => 20, 'min' => 0, 'max' => 30],
['key' => 'header_newposts_radius', 'label' => '按钮圆角(胶囊)', 'type' => 'switch', 'default' => true],
['key' => 'header_newposts_class', 'label' => '样式类', 'type' => 'input', 'default' => ''],
['key' => 'header_newposts_types', 'label' => '发布类型', 'type' => 'select', 'default' => ['post'], 'options' => [
['label' => '文章', 'value' => 'post'],
+31
View File
@@ -221,6 +221,37 @@ trait ScriptsPart2 {
];
}
}
} elseif ($type === 'topic' && post_type_exists('aksrt_topic')) {
$posts = get_posts([
'post_type' => 'aksrt_topic',
'post_status' => 'publish',
's' => $q,
'posts_per_page' => 6,
'no_found_rows' => true,
]);
foreach ($posts as $p) {
$items[] = [
'title' => $p->post_title,
'url' => get_permalink($p),
'meta' => get_the_date('', $p),
];
}
} elseif ($type === 'product' && post_type_exists('aksrt_product')) {
$posts = get_posts([
'post_type' => 'aksrt_product',
'post_status' => 'publish',
's' => $q,
'posts_per_page' => 6,
'no_found_rows' => true,
]);
foreach ($posts as $p) {
$items[] = [
'title' => $p->post_title,
'url' => get_permalink($p),
'meta' => get_the_date('', $p),
];
}
} elseif ($type === 'tag') {
$terms = get_terms([
'taxonomy' => 'post_tag',
+16 -5
View File
@@ -69,13 +69,24 @@ trait FacadeBulk {
$types = array_values(array_filter(array_map('sanitize_key', $s['header_newposts_types'])));
}
// zibll nav_newposts_radius is bool pill; map true→20px, false→0. Legacy int still accepted once.
$raw_radius = $s['header_newposts_radius'] ?? true;
if (is_bool($raw_radius) || $raw_radius === '0' || $raw_radius === '1' || $raw_radius === 0 || $raw_radius === 1) {
$radius_px = !empty($raw_radius) ? 20 : 0;
$radius_pill = !empty($raw_radius);
} else {
$radius_px = max(0, min(30, (int) $raw_radius));
$radius_pill = $radius_px >= 16;
}
return [
// Default on like zibll nav_newposts when key unset.
'enabled' => !isset($s['header_newposts_enabled']) || !empty($s['header_newposts_enabled']),
'text' => trim((string) ($s['header_newposts_text'] ?? '<i class="fa fa-pencil"></i> 发布')),
'radius' => max(0, min(30, (int) ($s['header_newposts_radius'] ?? 20))),
'class' => sanitize_html_class((string) ($s['header_newposts_class'] ?? '')),
'types' => $types,
'enabled' => !isset($s['header_newposts_enabled']) || !empty($s['header_newposts_enabled']),
'text' => trim((string) ($s['header_newposts_text'] ?? '<i class="fa fa-pencil"></i> 发布')),
'radius' => $radius_px,
'radius_pill' => $radius_pill,
'class' => sanitize_html_class((string) ($s['header_newposts_class'] ?? '')),
'types' => $types,
];
}