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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user