Hey there WordPress community,
Google page speed is moaning about dashicons.min.css being on our site. However, we need it for the Mega menu.
I wanted to know if it's possible to move it to the footer.
I have tried this code already:
add_action( 'wp_print_styles', 'my_deregister_styles' );
function my_deregister_styles() {
wp_deregister_style( 'dashicons' );
wp_enqueue_style( 'dashicons', array(), false, true );
}
I have also tried a few other samples, however, nothing seems to work here.
Any ideas?
Thanks
Hey there WordPress community,
Google page speed is moaning about dashicons.min.css being on our site. However, we need it for the Mega menu.
I wanted to know if it's possible to move it to the footer.
I have tried this code already:
add_action( 'wp_print_styles', 'my_deregister_styles' );
function my_deregister_styles() {
wp_deregister_style( 'dashicons' );
wp_enqueue_style( 'dashicons', array(), false, true );
}
I have also tried a few other samples, however, nothing seems to work here.
Any ideas?
Thanks
Share Improve this question asked Jun 28, 2019 at 10:13 ChrisChris 234 bronze badges2 Answers
Reset to default 0Please try below code :
add_action( 'wp_print_styles', 'my_deregister_styles' );
function my_deregister_styles() {
wp_deregister_style( 'dashicons' );
}
Replace your css path "PATH_OF_CSS" :
add_action( 'wp_footer', 'register_wp_footer', 11 );
function register_wp_footer() {
wp_enqueue_style( 'dashicons', 'PATH_OF_CSS' ,array(), false, true );
}
Final working solution was:
add_action( 'wp_print_styles', 'my_deregister_styles' );
function my_deregister_styles() {
wp_deregister_style( 'dashicons' );
}
add_action( 'wp_footer', 'register_wp_footer' );
function register_wp_footer() {
wp_enqueue_style( 'dashicons', '/wp-includes/css/dashicons.min.css');
}
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745361812a4624396.html
评论列表(0条)