Skip to content

Instantly share code, notes, and snippets.

@metaylimpo
Last active September 19, 2022 20:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save metaylimpo/e4a4f8c0c2a9afdeee4f9e570d5e176d to your computer and use it in GitHub Desktop.
Save metaylimpo/e4a4f8c0c2a9afdeee4f9e570d5e176d to your computer and use it in GitHub Desktop.
Speed Up Elementor
<?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 );
// disble FA
add_action( 'elementor/frontend/after_register_styles',function() {
foreach( [ 'solid', 'regular', 'brands' ] as $style ) {
wp_deregister_style( 'elementor-icons-fa-' . $style );
}
}, 20 );
// if you want to replace FA with your cutom set or critical icons file use this
add_action( 'wp_enqueue_scripts', 'replace_font_awesome', 3 );
function replace_font_awesome() {
wp_enqueue_style( 'font-awesome', 'path to your file' );
}
// disable eicons
add_action( 'wp_enqueue_scripts', 'remove_eicons', 20 );
function remove_eicons() {
// if you want the icons for admin in the backend
if ( is_admin() ) {
return;
}
wp_deregister_style( 'elementor-icons' );
}
// for hamburger menu icons use this CSS in the menu widget:
.eicon-menu-bar {
display: inline-block;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
//this is for open menu
.elementor-menu-toggle i:before {
your svg font or fa or text;
}
// this is for close menu
.elementor-menu-toggle.elementor-active i:before {
your svg font or fa or text;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment