Deactivated W3TC lazy loading and rely on Wordpress' own lazy loading
approach to enable images for non-JS users.
This commit is contained in:
@@ -40,6 +40,20 @@ function c1024_2026_assets() {
|
|||||||
// Load public assets through WordPress so dependencies and plugin integrations remain ordered.
|
// Load public assets through WordPress so dependencies and plugin integrations remain ordered.
|
||||||
add_action( 'wp_enqueue_scripts', 'c1024_2026_assets' );
|
add_action( 'wp_enqueue_scripts', 'c1024_2026_assets' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Keep W3 Total Cache from converting every image into a JavaScript-only placeholder.
|
||||||
|
*
|
||||||
|
* Native browser lazy loading can still be enabled elsewhere, but W3TC's output-buffer
|
||||||
|
* mutator removes `src` entirely and therefore prevents images from working without JS.
|
||||||
|
*/
|
||||||
|
function c1024_2026_disable_w3tc_javascript_lazyload( $can_process ) {
|
||||||
|
$can_process['enabled'] = false;
|
||||||
|
$can_process['reason'] = 'Commander1024 theme preserves non-JavaScript image delivery';
|
||||||
|
|
||||||
|
return $can_process;
|
||||||
|
}
|
||||||
|
add_filter( 'w3tc_lazyload_can_process', 'c1024_2026_disable_w3tc_javascript_lazyload' );
|
||||||
|
|
||||||
function c1024_2026_block_editor_assets() {
|
function c1024_2026_block_editor_assets() {
|
||||||
// Load the complete canvas stylesheet inside Gutenberg's editor iframe.
|
// Load the complete canvas stylesheet inside Gutenberg's editor iframe.
|
||||||
wp_enqueue_style( 'c1024-2026-editor-style', get_theme_file_uri( '/editor-style.css' ), array(), '1.0.0' );
|
wp_enqueue_style( 'c1024-2026-editor-style', get_theme_file_uri( '/editor-style.css' ), array(), '1.0.0' );
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ Description: A clean, retro-tech inspired classic WordPress theme.
|
|||||||
Author: Commander1024
|
Author: Commander1024
|
||||||
Version: 1.0.0
|
Version: 1.0.0
|
||||||
Text Domain: c1024-2026
|
Text Domain: c1024-2026
|
||||||
License: GNU General Public License v2 or later
|
License: GNU General Public License v3
|
||||||
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Self-hosted typefaces: keep these paths relative to the theme stylesheet. */
|
/* Self-hosted typefaces: keep these paths relative to the theme stylesheet. */
|
||||||
|
|||||||
Reference in New Issue
Block a user