Merge pull request 'Worktree fix user card vip btn' (#286) from worktree-fix-user-card-vip-btn into main

Reviewed-on: CYL/wordpress-theme-aksrt#286
This commit is contained in:
kate522 committed 2026-07-25 12:21:52 +08:00
commit c85774f9a0
2 files changed
+40 -6

No files matched your search

@@ -67,9 +67,14 @@
/* Multi-type toggle lives outside .navbar-but-cluster on live zibll DOM. /* Multi-type toggle lives outside .navbar-but-cluster on live zibll DOM.
* Paint classes (jb-*) set --this-bg on the toggle; force them to show. */ * Paint classes (jb-*) set --this-bg on the toggle; force them to show. */
.navbar-top .navbar-form.navbar-but .newadd-btns__toggle.navbar-cta, .navbar-top .navbar-form.navbar-but .newadd-btns__toggle.navbar-cta,
.navbar-top .navbar-but .newadd-btns__toggle.navbar-cta { .navbar-top .navbar-but .newadd-btns__toggle.navbar-cta,
.navbar-top .navbar-form.navbar-but a.navbar-newposts.navbar-cta,
.navbar-top .navbar-form.navbar-but a.newadd-btns.navbar-cta {
display: inline-flex !important;
visibility: visible !important;
opacity: 1 !important;
color: #fff !important; color: #fff !important;
background: var(--this-bg, var(--color-primary, #2f6df6)) !important; background: var(--this-bg, linear-gradient(135deg, #59c3fb 10%, #268df7 100%)) !important;
border-radius: var(--navbar-cta-radius, 50px); border-radius: var(--navbar-cta-radius, 50px);
cursor: pointer; cursor: pointer;
} }
@@ -798,3 +803,20 @@ body.dark-theme .toggle-theme .theme-icon-sun {
width: min(220px, 42vw); width: min(220px, 42vw);
} }
} }
/* Ensure publish form is never zero-sized */
.navbar-top .navbar-form.navbar-but {
display: flex !important;
align-items: center !important;
visibility: visible !important;
min-width: 0;
flex: 0 0 auto;
}
.navbar-top .navbar-form.navbar-but .newadd-btns.hover-show {
display: block !important;
visibility: visible !important;
width: fit-content !important;
max-width: fit-content !important;
line-height: normal !important;
}
+16 -4
View File
@@ -53,9 +53,11 @@ if (!function_exists('aksrt_get_new_add_actions')) :
foreach ($types as $type) { foreach ($types as $type) {
$type = sanitize_key((string) $type); $type = sanitize_key((string) $type);
if ($type === 'post') { if ($type === 'post') {
$url = function_exists('aksrt_get_new_post_url') ? aksrt_get_new_post_url() : admin_url('post-new.php'); // Front submit page may be unset → aksrt_get_new_post_url() returns ''.
// Never drop the publish chip for that: fall back to WP post-new.
$url = function_exists('aksrt_get_new_post_url') ? (string) aksrt_get_new_post_url() : '';
if ($url === '') { if ($url === '') {
continue; $url = admin_url('post-new.php');
} }
$out[] = [ $out[] = [
'type' => 'post', 'type' => 'post',
@@ -165,7 +167,17 @@ if (!function_exists('aksrt_render_new_add_btns')) :
function aksrt_render_new_add_btns(array $types, string $class = '', string $label = ''): string { function aksrt_render_new_add_btns(array $types, string $class = '', string $label = ''): string {
$actions = aksrt_get_new_add_actions($types); $actions = aksrt_get_new_add_actions($types);
if (!$actions) { if (!$actions) {
return ''; // Last resort: keep a write-post entry so the top-nav chip is never blank.
$fallback = function_exists('aksrt_get_new_post_url') ? (string) aksrt_get_new_post_url() : '';
if ($fallback === '') {
$fallback = admin_url('post-new.php');
}
$actions = [[
'type' => 'post',
'url' => $fallback,
'label' => __('写文章', 'aksrt'),
'icon' => 'fas fa-file-alt',
]];
} }
if ($label === '') { if ($label === '') {
$label = __('发布', 'aksrt'); $label = __('发布', 'aksrt');
@@ -180,7 +192,7 @@ if (!function_exists('aksrt_render_new_add_btns')) :
if ($token === 'newadd-btns') { if ($token === 'newadd-btns') {
continue; continue;
} }
if ($token === 'btn-primary' || $token === 'but' || $token === 'navbar-cta' || str_starts_with($token, 'jb-')) { if ($token === 'btn-primary' || $token === 'but' || $token === 'navbar-cta' || $token === 'radius' || $token === 'main-radius' || $token === 'mini-radius' || str_starts_with($token, 'jb-') || str_starts_with($token, 'b-')) {
$cta_tokens[] = $token; $cta_tokens[] = $token;
continue; continue;
} }