feat(frontend): replace lazy loading with zibll lazysizes
This commit is contained in:
@@ -115,9 +115,11 @@ if (!function_exists('aksrt_get_avatar_html')) {
|
||||
'alt' => '',
|
||||
'width' => (string) $size,
|
||||
'height' => (string) $size,
|
||||
'loading' => 'lazy',
|
||||
];
|
||||
$attrs = array_merge($defaults, $attrs);
|
||||
unset($attrs['loading']);
|
||||
$class = (string) ($attrs['class'] ?? $defaults['class']);
|
||||
unset($attrs['class']);
|
||||
$html_attrs = '';
|
||||
foreach ($attrs as $name => $value) {
|
||||
$name = sanitize_key((string) $name);
|
||||
@@ -126,7 +128,7 @@ if (!function_exists('aksrt_get_avatar_html')) {
|
||||
}
|
||||
$html_attrs .= ' ' . $name . '="' . esc_attr((string) $value) . '"';
|
||||
}
|
||||
return '<img src="' . esc_url($url) . '"' . $html_attrs . ' />';
|
||||
return '<img' . aksrt_get_lazy_attr('lazy_avatar', $url, $class, aksrt_get_default_avatar_url()) . $html_attrs . '>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user