Having (had) lazy eyes myself I cannot help but sympathize with this band of Aussie youngsters. And “Where is my Brain??” is some crazy psychedelic motorik-beat (with a fill) driven piece of geniousness.
OK, that might be somewhat of an exaggeration, but look & listen carefully headphones on and the volume turned to 11!
lang:en
Blogposts on blog.futtta.be in English (mostly because these posts are republished in a non-Dutch-speaking context).
Autoptimize Image Optimization to be less “lazy” with pictures
Up until now Autoptimize, when performing image optimization, relies on JS-based lazyloading (with the great lazysizes component) to differentiate between browser that support different image formats (AVIF, WebP and JPEG as fallback).
As JS-based Lazyload is going out of fashion though (with native lazyload being supported by more browsers and WordPress having out-of-the-box support for it too), it is time to start working on <picture> output in Autoptimize to serve “nextgen image formats” where different <source> tags offer the AVIF and WebP files and the <img> tag (which includes the loading=”lazy” attribute) with JPEG as fallback.
For now that functionality is in a separate “power-up”, available on Github. If you have Image Optimization active in Autoptimize (and you are on the Beta version, Autoptimize 2.8.1 is missing a filter which the power-up needs so download & install the Beta if not done yet), you can download the plugin Github and give it a go. All feedback is welcome!
Fix for Elementor 3.1 YouTube not LYTE anymore
Elementor 3.1 came with “refactored YouTube source to use YouTube API in Video widget” which resulted in WP YouTube Lyte not being able to lyten up the YouTubes any more. Below code snippet (consider it beta) hooks into Elementor to fix this regression;
add_filter( 'elementor/frontend/widget/should_render', function( $should_render, $elementor_element ) { if ( function_exists( 'lyte_preparse' ) && 'Elementor\Widget_Video' === get_class( $elementor_element ) ) { $pas = get_private_property( $elementor_element , 'parsed_active_settings'); if ( ! empty( $pas['youtube_url'] ) ) { echo lyte_preparse( $pas['youtube_url'] ); return false; } } return $should_render; }, 10, 2 ); // from https://www.lambda-out-loud.com/posts/accessing-private-properties-php/ function get_private_property( object $object, string $property ) { $array = (array) $object; $propertyLength = strlen( $property ); foreach ( $array as $key => $value ) { if ( substr( $key, -$propertyLength ) === $property ) { return $value; } } }
Hat tip to Koen for his assistance in digging into Elementor, much appreciated!
AO image optimization: transparent .png to avif issue
if “Load WebP or AVIF in supported browsers?” is on, .png
files with transparency will loose that transparency in browsers that support AVIF due to a recent technical change in Shortpixel’s AVIF toolchain.
Shortpixel is looking at alternative solutions, but until then as a workaround you can either:
- add
.png
to Autoptimize’s lazyload exclusion field - or to use below code snippet to disable AVIF images;
add_filter( 'autoptimize_filter_imgopt_do_avif', '__return_false');
Music from Our Tube: Robert Wyatt’s cover of “At Last I Am Free”
Last Sunday-evening while making the beds, listening to Charlotte Adigéry’s very enjoyable radioshow on Stubru, I heard “At last I Am Free”. Turns out Robert Wyatt actually covered this pretty uncharacteristic Chic-song, but I prefer his version:
2020: the year Flash was finally buried
10 years after it became irrelevant (one of the first blogposts I wrote that generated discussions & traffic), Flash is now officially buried;
AO not lazyloading above the fold; the sequel
So in the ever-continuing saga of learning, testing and fine-tuning your site’s settings to get the ultimate in performance you might have enjoyed the new Autoptimize filter/ setting not to lazyload the first N images to keep the impact of lazyloading on Largest Contentfull Paint down?
Well, now you can take things a step further with below code snippet, which tells Autoptimize not to lazyload the logo and the featured image (hat tip to Gijo Varghese of Flying Press for the idea).
add_filter('autoptimize_filter_imgopt_lazyload_exclude_array', function( $lazy_excl ){ // site logo. $custom_logo_id = get_theme_mod( 'custom_logo' ); $image = wp_get_attachment_image_src( $custom_logo_id , 'full' ); $logo = $image[0]; if ( ! empty( $logo ) ) { $lazy_excl[] = $logo; } // featured image. if ( is_single() || is_page() ) { $featured_img = get_the_post_thumbnail_url(); if ( ! empty( $featured_img ) ) { $lazy_excl[] = $featured_img; } } return $lazy_excl; });
This might end up in a future version of Autoptimize, maybe even preloading those images … 🙂
The song of 2020: I know the end – Phoebe Bridgers
Phoebe Bridgers was everywhere this year; Better Oblivion Community Center with Conor Oberst, her cover of The Goo Goo Doll’s “Iris” with Maggie Rogers to celebrate Trump’s defeat, but most importantly her solo album with this impressive multi-faceted and deeply touching “I know the end”.
Music from our Tube: Black Country, New Road – ‘Science Fair’
A song I Shazammed twice in the last couple of days when hearing it on PBB and which I’ve just now listened to 5 times already as it really is that intense, angry, chaotic, poetic and … well, good? The video is pretty great as well! Black Country, New Road – ‘Science Fair’
Fixed: WordPress 5.6 required Autoptimize settings change
PSA: WordPress 5.6 changes the filename of jQuery core. If you’re using Autoptimize and you have jQuery excluded (which is default) you will want to update your JS optimization exclusion list from js/jquery/jquery.js
to js/jquery/jquery.min.js
.
Update: Autoptimize 2.8 will automagically fix this, urgently looking for some testers to download https://github.com/futtta/autoptimize/archive/beta.zip (make sure 2.7.8 is disabled when enabling the beta). If all goes well and I get some confirmation the update (which has a lot more then just the fix) will go out today!
Update2: AO28 was released, all is (or should be) OK now 🙂