View speedup elementor.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// disable google fonts | |
add_filter( 'elementor/frontend/print_google_fonts', '__return_false' ); | |
// add font-display swap to elementor custom fonts | |
add_filter( 'elementor_pro/custom_fonts/font_display', function( $current_value, $font_family, $data ) { | |
return 'swap'; | |
// you can also play also with $current_value & $font_family for specific requirments | |
}, 10, 3 ); |
View .htaccess
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#DO NOT COPY\PASTE. Take only what you need carefully. | |
#The following code is just a few **examples** of optimizations that you can do in .htaccess file. | |
# HTTPS forced | |
<IfModule mod_rewrite.c> | |
#RewriteCond %{HTTP_HOST} !^www\. [NC] | |
#RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
RewriteCond %{HTTP:X-Forwarded-Proto} !https |
View functions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
DO NOT COPY\PASTE. Take only what you need carefully. | |
The following code is just a few **examples** of optimizations that you can do in functions.php file. | |
*/ | |
<?php | |
// disable google fonts | |
add_filter( 'elementor/frontend/print_google_fonts', '__return_false' ); |
View defer example.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!is_admin()) { | |
add_filter( 'script_loader_tag', function ( $tag, $handle ) { | |
if ( strpos( $tag, "jquery.js" ) || | |
strpos( $tag, "leaflet.js") /*|| | |
strpos( $tag, "add any script you want" )*/ ) { | |
return $tag; | |
} | |
return str_replace( ' src', ' defer="defer" src', $tag ); |