Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1377724

    Hello,
    i have problems with the layerslider layout when i set “CSS File Merging And Compression” to “enable” under Performance. How can I exclude that the layerslider.css is compressed? If I don’t “merge”, I have 74 css files more, absolutely not acceptable. So, how can I load layerslider.css normally and “merging” the rest?

    #1377785

    Hey spee65,

    Thank you for the inquiry.

    You can add this filter in the functions.php file to exclude the layerslider.css file from the merged file.

    function avia_exclude_files_from_compression($excluded_files){
      $exclude_js = array( 'layerslider');
      $excluded_files['js'] = array_merge($excluded_files['js'], $exclude_js);
      return $excluded_files;
    }
    add_filter('avf_exclude_assets', 'avia_exclude_files_from_compression', 10, 1);

    Please make sure to toggle the Enfold > Performance > File Compression settings after adding the filter.

    Best regards,
    Ismael

    #1377804
    This reply has been marked as private.
    #1377807

    yes – and if you like to exclude the css files it works similar to the above filter:

    function avia_exclude_files_from_compression($excluded_files){
      // exclude css 
      $exclude_css = array( 'layerslider', 'abc', 'xyz');  // comma separated list of enqueue names
      $excluded_files['css'] = array_merge($excluded_files['css'], $exclude_css);
    
      // exclude js files
      $exclude_js = array( 'avia_google_recaptcha_front_script', 'abc_script');   // comma separated list of enqueue names
      $excluded_files['js'] = array_merge($excluded_files['js'], $exclude_js);
      return $excluded_files;
    }
    add_filter('avf_exclude_assets', 'avia_exclude_files_from_compression', 10, 1);

    it is mentioned as comment to insert the list of enqueued names ! – example given here is recaptcha script
    the enqueue name is: avia_google_recaptcha_front_script
    the script name is: avia_google_recaptcha_front ( with that in the list it won’t work ) : the script name is therefore not determinant here

    #1377810
    This reply has been marked as private.
    #1377811
    This reply has been marked as private.
    #1377812

    edited the snippet above to clarify what to insert.

    #1377813
    This reply has been marked as private.
    #1377814

    no private content for me – you had to wait then for mods

    by the way
    – if you have jQuery set to load in the footer, then I’m not sure if excluding will also cause those files to be loaded in the footer.

    #1377815
    This reply has been marked as private.
    #1377816

    all fine, thanks for your help!

    Best redgards

    #1377858

    Hi,

    Great, I’m glad that @guenni007 could help you out. Please let us know if you should need any further help on the topic, or if we can close it.

    Best regards,
    Rikard

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