feat(frontend): replace lazy loading with zibll lazysizes

This commit is contained in:
2026-08-18 01:33:38 +08:00
parent 02571eecd6
commit 435ee1daa7
78 changed files with 1515 additions and 909 deletions
+4 -6
View File
@@ -119,7 +119,7 @@ if (!function_exists('aksrt_single_render_cover')) :
<?php else : ?>
<div class="graphic mb20 single-cover single-cover--slide imgbox-container" style="padding-bottom:calc(<?php echo esc_attr((string) $img_scale); ?>% + 50px);">
<?php foreach ($slides as $idx => $slide_url) : ?>
<img src="<?php echo esc_url($slide_url); ?>" alt="" class="fit-cover" style="<?php echo $idx === 0 ? '' : 'display:none;'; ?>" loading="<?php echo $idx === 0 ? 'eager' : 'lazy'; ?>">
<img<?php echo aksrt_get_lazy_attr('lazy_sider', (string) $slide_url, 'fit-cover', aksrt_get_lazy_thumb('lg')); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> alt="" style="<?php echo $idx === 0 ? '' : 'display:none;'; ?>">
<?php endforeach; ?>
<?php echo $overlay; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
@@ -130,13 +130,11 @@ if (!function_exists('aksrt_single_render_cover')) :
endif;
// Image cover (default).
$img_attrs = function_exists('aksrt_lazy_img_attrs')
? aksrt_lazy_img_attrs((string) $ctx['cover_url'], 'cover', 'fit-cover')
: 'class="fit-cover" src="' . esc_url((string) $ctx['cover_url']) . '" loading="eager"';
$img_attrs = aksrt_get_lazy_attr('lazy_cover', (string) $ctx['cover_url'], 'fit-cover', aksrt_get_lazy_thumb('lg'));
?>
<div class="single-head-cover">
<div class="graphic mb20 single-cover imgbox-container" style="padding-bottom:calc(<?php echo esc_attr((string) $img_scale); ?>% + 50px);">
<img <?php echo $img_attrs; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> alt="<?php echo esc_attr(wp_strip_all_tags(get_the_title())); ?>">
<img<?php echo $img_attrs; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> alt="<?php echo esc_attr(wp_strip_all_tags(get_the_title())); ?>">
<div class="abs-center left-bottom single-cover-con">
<h1 class="article-title title-h-left"><?php echo $title_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></h1>
<?php if ($crumbs !== '') : ?>
@@ -480,7 +478,7 @@ if (!function_exists('aksrt_single_render_author_card')) :
?>
<a class="item mr10 mb10" href="<?php echo esc_url(get_permalink($rp)); ?>" style="display:block;width:46%;">
<?php if ($thumb) : ?>
<img class="fit-cover radius8" src="<?php echo esc_url($thumb); ?>" alt="" loading="lazy" decoding="async" style="width:100%;aspect-ratio:16/10;object-fit:cover;" />
<img<?php echo aksrt_get_lazy_attr('lazy_posts_thumb', (string) $thumb, 'fit-cover radius8'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> alt="" decoding="async" style="width:100%;aspect-ratio:16/10;object-fit:cover;">
<?php endif; ?>
<div class="em09 mt6 text-ellipsis"><?php echo esc_html(get_the_title($rp)); ?></div>
</a>