fix(frontend): remove residual post thumbnail lazy path

This commit is contained in:
kate522 committed 2026-08-18 01:52:00 +08:00
1 parent 435ee1daa7
commit fb11a7ed0c
8 files changed
+27 -15

No files matched your search

+7 -4
View File
@@ -39,7 +39,6 @@ if (!function_exists('aksrt_renderer_defaults')) {
'show_thumb' => true,
'thumb_ratio' => '4:3',
'thumb_fit' => 'cover',
'thumb_lazy' => true,
'thumb_if_has' => false,
'target_blank' => false,
'title_html' => '',
@@ -328,9 +327,13 @@ if (!function_exists('aksrt_renderer_resolve_images')) {
}
$thumb_settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_post_thumb_settings() : [];
$allow_fallback = !empty($thumb_settings['rand_thumb']) || !empty($cfg['thumb_if_has']);
if ($primary === '' && $allow_fallback) {
$primary = aksrt_renderer_random_fallback_image($post_id);
$fallback = sanitize_key((string) ($thumb_settings['fallback'] ?? 'placeholder'));
if ($primary === '' && empty($cfg['thumb_if_has'])) {
if ($fallback === 'random') {
$primary = aksrt_renderer_random_fallback_image($post_id);
} elseif ($fallback === 'placeholder') {
$primary = aksrt_get_lazy_thumb();
}
}
return [
+1 -3
View File
@@ -170,9 +170,7 @@ if (!function_exists('aksrt_renderer_mini')) {
$target_attr = !empty($cfg['target_blank']) ? ' target="_blank"' : '';
if ($cfg['show_thumb'] && !empty($data['has_img'])) {
$fit_class = !empty($cfg['thumb_fit']) && $cfg['thumb_fit'] === 'contain' ? 'fit-contain' : 'fit-cover';
$thumb_attr = !empty($cfg['thumb_lazy'])
? aksrt_get_lazy_attr('lazy_posts_thumb', (string) $data['img_url'], $fit_class)
: ' class="' . esc_attr($fit_class) . '" src="' . esc_url($data['img_url']) . '"';
$thumb_attr = aksrt_get_lazy_attr('lazy_posts_thumb', (string) $data['img_url'], $fit_class);
$thumb_img = '<img' . $thumb_attr . ' alt="' . esc_attr($data['title']) . '">';
$thumb_html = '<a href="' . esc_url($data['permalink']) . '" class="item-thumbnail" aria-label="' . esc_attr($data['title']) . '"' . $target_attr . '>' . $thumb_img . '</a>';
+1 -3
View File
@@ -113,9 +113,7 @@ if (!function_exists('aksrt_renderer_thumb')) {
$has_real_img = !empty($data['has_real_img']);
$fit_class = !empty($cfg['thumb_fit']) && $cfg['thumb_fit'] === 'contain' ? 'fit-contain' : 'fit-cover';
$img_attr = !empty($cfg['thumb_lazy'])
? aksrt_get_lazy_attr('lazy_posts_thumb', $img, $fit_class)
: ' class="' . esc_attr($fit_class) . '" src="' . esc_url($img) . '"';
$img_attr = aksrt_get_lazy_attr('lazy_posts_thumb', $img, $fit_class);
$img_html = '<img' . $img_attr . ' alt="' . esc_attr($title) . '">';
$sticky_html = ($is_sticky && !empty($cfg['badge_show']))