Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #1255706


    I’m trying to optimize our front page. I noticed it is loading a lot of CSS, that isn’t even used on that front page, e.g. it’s loading:

    – timeline.css + .js
    – team.css + .js
    – slideshow.css + .js
    – and many CSS and JS files for elements…

    none of which are used on that page. The Enfold performance setting is turned on (“only load used elements”), which makes this even more confusing.

    Anyway, I want to dequeue the styles in my child themes function.php, I did this:

    // Remove unneeded resource
    function wp_remove_home_resources() {
    	if(is_home() || is_front_page()){ 
    		// example with timeline
    		wp_dequeue_style( 'avia-module-timeline' ); // not working
    		wp_dequeue_script( 'avia-module-timeline' ); // this works
    add_action( 'wp_print_scripts', 'wp_remove_home_resources', 100 );

    I tried everything, but the page keeps on loading those css files. I checked enfold source code to verify the names the styles get enqueued with, and they are correct, but it’s not working.


    Hey caweint,

    Thank you for the inquiry.

    Did you enable the css and js file compression settings? These settings will override the “Load only used elements” option, so the theme will still load all assets including files for the elements that are not actually added in the site. This is to make sure that compressed files contain all assets from all elements regardless of the page or of the elements that are actually present in the page.

    Best regards,

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.