Created
September 20, 2022 22:08
-
-
Save rilexz/b6ac318e94a33ee90afce9d3b63e78f0 to your computer and use it in GitHub Desktop.
Added more to speed-up functions for elementor framework
This file contains hidden or 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 ); | |
// 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