Changeset 3045542
- Timestamp:
- 03/05/2024 10:23:48 AM (5 months ago)
- Location:
- cibeles-ai/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cibeles-ai/trunk/cibeles-ai.php
r3036333 r3045542 31 31 ]; 32 32 33 34 35 33 36 if ( is_admin() ) { 34 37 require_once $cibelesAiPlugin['path'] . 'init.php'; 35 38 require_once $cibelesAiPlugin['path'] . 'functions.php'; 36 39 require_once $cibelesAiPlugin['path'] . 'options.php'; 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 37 57 } 38 58 -
cibeles-ai/trunk/init.php
r3045536 r3045542 266 266 } 267 267 268 //Mejora la carga de la página en la vista de post haciendo una precarga de la imagen webp269 add_action('wp_head', 'preload_post_thumbnail_in_webp_format_if_exists');270 271 function preload_post_thumbnail_in_webp_format_if_exists(){272 if (has_post_thumbnail() && is_single()) {273 $attachment_id = get_post_thumbnail_id();274 $attachment_path = get_attached_file($attachment_id);275 $attachment_path_webp = $attachment_path . '.webp';276 if (file_exists($attachment_path_webp)) {277 $upload_dir = wp_upload_dir();278 $attachment_url_webp = str_replace($upload_dir['basedir'], $upload_dir['baseurl'], $attachment_path_webp);279 echo '<link rel="preload" as="image" href="' . esc_url($attachment_url_webp) . '">';280 }281 }282 }283
Note: See TracChangeset
for help on using the changeset viewer.