Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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