diff --git a/functions.php b/functions.php
index cf84a92..a04ad55 100644
--- a/functions.php
+++ b/functions.php
@@ -1105,6 +1105,33 @@ function argon_get_post_thumbnail($postID = 0){
}
return apply_filters("argon_post_thumbnail", argon_get_first_image_of_article());
}
+
+/**
+ * 生成带懒加载的缩略图 HTML
+ * @param int $postID 文章 ID
+ * @param string $class 额外的 CSS 类
+ * @param string $alt 图片 alt 属性
+ * @return string 图片 HTML 标签
+ */
+function argon_get_post_thumbnail_html($postID = 0, $class = 'post-thumbnail', $alt = 'thumbnail'){
+ $thumbnail_url = argon_get_post_thumbnail($postID);
+ if (!$thumbnail_url) {
+ return '';
+ }
+
+ // 检查是否启用懒加载
+ if (get_option('argon_enable_lazyload', 'true') == 'false') {
+ // 未启用懒加载,直接输出图片
+ return "";
+ }
+
+ // 启用懒加载
+ $loading_style = get_option('argon_lazyload_loading_style', '1');
+ $style_class = ($loading_style !== 'none') ? ' lazyload-style-' . $loading_style : '';
+ $placeholder = 'data:image/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPg==';
+
+ return "
";
+}
//文末附加内容
function get_additional_content_after_post(){
global $post;
@@ -3229,7 +3256,8 @@ function get_banner_background_url(){
}
//懒加载:对
标签添加懒加载支持
function argon_lazyload($content){
- if (!is_feed() && !is_robots() && !is_home()) {
+ // 移除 !is_home() 限制,允许在首页也使用懒加载
+ if (!is_feed() && !is_robots()) {
$loading_style = get_option('argon_lazyload_loading_style', '1');
// 占位图 base64(用于触发 CSS 加载动画)
$placeholder = 'data:image/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPg==';
diff --git a/template-parts/content-preview-1.php b/template-parts/content-preview-1.php
index 95feae7..f2bd85d 100644
--- a/template-parts/content-preview-1.php
+++ b/template-parts/content-preview-1.php
@@ -6,9 +6,7 @@
if (argon_has_post_thumbnail()){
- $thumbnail_url = argon_get_post_thumbnail();
-
- echo "
";
+ echo argon_get_post_thumbnail_html(0, 'post-thumbnail', 'thumbnail');
echo "