fix(single): match reference article action bar 1:1

The action bar used a locally invented pill-chip style that overrode the
reference theme's 80px icon-over-text columns, and the JS toggled a
class no stylesheet targeted — so likes/favorites showed no selected
state at all.

- restore reference markup: <svg class="icon"> + <text>/<count> and the
  actived class, with data-stat-count/data-base-count preserved
- toggle actived plus a transient action-animation so the lovestar
  keyframes finally reach the DOM
- drop the CSS overrides and now-dead action-btn/.action-btn--reward
  and .post-actions-card rules; main.css already carried the reference
  rules the overrides were shadowing
This commit is contained in:
kate522 committed 2026-09-27 15:39:09 +08:00
1 parent 1ce8e263c3
commit 8d16ce6e02
13 files changed
+43 -255

No files matched your search

+3 -1
View File
@@ -24,11 +24,13 @@ if (!function_exists('aksrt_get_rewards_button')) {
}
$settings = \AKSRT\Settings\Settings::get_post_page_settings();
$label = (string) ($settings['rewards_btn_text'] ?? __('赞赏', 'aksrt'));
$icon = function_exists('aksrt_icon_markup') ? aksrt_icon_markup('zibsvg-money') : '';
return sprintf(
'<button type="button" class="%1$s aksrt-reward-open" data-aksrt-reward-open data-user-id="%2$d" data-post-id="%3$d"><i class="fa fas fa-gift em09" aria-hidden="true"></i> <span class="action-btn__label">%4$s</span></button>',
'<button type="button" class="%1$s aksrt-reward-open" data-aksrt-reward-open data-user-id="%2$d" data-post-id="%3$d">%4$s<text>%5$s</text></button>',
esc_attr($class),
$user_id,
$post_id,
$icon, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed sprite markup.
esc_html($label)
);
}
+12 -8
View File
@@ -195,10 +195,12 @@ if (!function_exists('aksrt_single_render_actions')) :
<div class="text-center muted-3-color box-body em09"><?php echo esc_html($settings['button_toptext'] ?? __('喜欢就支持一下吧', 'aksrt')); ?></div>
<div class="post-actions-wrap relative">
<div class="text-center post-actions">
<?php if (!empty($settings['like_enabled'])) : ?>
<button type="button" class="action action-like<?php echo $is_liked ? ' is-active' : ''; ?>" id="action-like" data-post-id="<?php echo esc_attr((string) $post_id); ?>" data-initial-active="<?php echo $is_liked ? '1' : '0'; ?>">
<i class="<?php echo $is_liked ? 'fa' : 'fa'; ?> fa-heart" aria-hidden="true"></i>
<span class="action-btn__count" data-stat-count="likes" data-base-count="<?php echo esc_attr((string) $like_count); ?>"><?php echo esc_html((string) $like_count); ?></span>
<?php
$like_icon = function_exists('aksrt_icon_markup') ? aksrt_icon_markup('zibsvg-like') : '';
if (!empty($settings['like_enabled'])) : ?>
<button type="button" class="action action-like<?php echo $is_liked ? ' actived' : ''; ?>" id="action-like" data-post-id="<?php echo esc_attr((string) $post_id); ?>" data-initial-active="<?php echo $is_liked ? '1' : '0'; ?>">
<?php echo $like_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed sprite markup. ?>
<text><?php esc_html_e('点赞', 'aksrt'); ?></text><count data-stat-count="likes" data-base-count="<?php echo esc_attr((string) $like_count); ?>"><?php echo esc_html((string) $like_count); ?></count>
</button>
<?php endif; ?>
@@ -217,10 +219,12 @@ if (!function_exists('aksrt_single_render_actions')) :
<?php echo aksrt_get_post_share_btn($post_id, 'action action-share'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php endif; ?>
<?php if (!empty($settings['favorite_enabled'])) : ?>
<button type="button" class="action action-favorite<?php echo $is_favorited ? ' is-active' : ''; ?>" id="action-favorite" data-post-id="<?php echo esc_attr((string) $post_id); ?>" data-initial-active="<?php echo $is_favorited ? '1' : '0'; ?>">
<i class="<?php echo $is_favorited ? 'fa' : 'fa'; ?> fa-star" aria-hidden="true"></i>
<span class="action-btn__count" data-stat-count="favorites" data-base-count="<?php echo esc_attr((string) $favorite_count); ?>"><?php echo esc_html((string) $favorite_count); ?></span>
<?php
$favorite_icon = function_exists('aksrt_icon_markup') ? aksrt_icon_markup('zibsvg-favorite') : '';
if (!empty($settings['favorite_enabled'])) : ?>
<button type="button" class="action action-favorite<?php echo $is_favorited ? ' actived' : ''; ?>" id="action-favorite" data-post-id="<?php echo esc_attr((string) $post_id); ?>" data-initial-active="<?php echo $is_favorited ? '1' : '0'; ?>">
<?php echo $favorite_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed sprite markup. ?>
<text><?php esc_html_e('收藏', 'aksrt'); ?></text><count data-stat-count="favorites" data-base-count="<?php echo esc_attr((string) $favorite_count); ?>"><?php echo esc_html((string) $favorite_count); ?></count>
</button>
<?php endif; ?>
</div>
@@ -421,29 +421,31 @@ if (!function_exists('aksrt_render_footer_tabbar_single_extend')) :
$comment_count = (int) get_comments_number($post_id);
if ($like_on) :
$like_tabbar_icon = function_exists('aksrt_icon_markup') ? aksrt_icon_markup('zibsvg-like') : '';
?>
<button type="button"
class="tabbar-item single-action-tabbar action-like<?php echo $is_liked ? ' is-active' : ''; ?>"
class="tabbar-item single-action-tabbar action-like<?php echo $is_liked ? ' actived' : ''; ?>"
data-type="like"
data-post-id="<?php echo esc_attr((string) $post_id); ?>"
data-initial-active="<?php echo $is_liked ? '1' : '0'; ?>"
aria-label="<?php esc_attr_e('点赞', 'aksrt'); ?>">
<i class="<?php echo $is_liked ? 'fa' : 'fa'; ?> fa-heart" aria-hidden="true"></i>
<?php if ($show_text) : ?><span data-stat-count="likes" data-base-count="<?php echo esc_attr((string) $like_count); ?>"><?php echo esc_html((string) $like_count); ?></span><?php endif; ?>
<?php echo $like_tabbar_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed sprite markup. ?>
<?php if ($show_text) : ?><count data-stat-count="likes" data-base-count="<?php echo esc_attr((string) $like_count); ?>"><?php echo esc_html((string) $like_count); ?></count><?php endif; ?>
</button>
<?php
endif;
if ($favorite_on) :
$favorite_tabbar_icon = function_exists('aksrt_icon_markup') ? aksrt_icon_markup('zibsvg-favorite') : '';
?>
<button type="button"
class="tabbar-item single-action-tabbar action-favorite<?php echo $is_favorited ? ' is-active' : ''; ?>"
class="tabbar-item single-action-tabbar action-favorite<?php echo $is_favorited ? ' actived' : ''; ?>"
data-type="favorite"
data-post-id="<?php echo esc_attr((string) $post_id); ?>"
data-initial-active="<?php echo $is_favorited ? '1' : '0'; ?>"
aria-label="<?php esc_attr_e('收藏', 'aksrt'); ?>">
<i class="<?php echo $is_favorited ? 'fa' : 'fa'; ?> fa-star" aria-hidden="true"></i>
<?php if ($show_text) : ?><span data-stat-count="favorites" data-base-count="<?php echo esc_attr((string) $favorite_count); ?>"><?php echo esc_html((string) $favorite_count); ?></span><?php endif; ?>
<?php echo $favorite_tabbar_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed sprite markup. ?>
<?php if ($show_text) : ?><count data-stat-count="favorites" data-base-count="<?php echo esc_attr((string) $favorite_count); ?>"><?php echo esc_html((string) $favorite_count); ?></count><?php endif; ?>
</button>
<?php
endif;