Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1276707

    Hi there,

    The Layerslider plugin has an option to load the script in the header or footer. Unfortunately Enfold is overriding this setting meaning it can’t be changed in the Layerslider settings, and always loads in the footer. For pages with a slider above the fold this generates a huge CLS event when the Slider loads after the page is complete.

    Can you please stop forcing this option so we have the choice of loading in the header or footer?

    #1277014

    Hey Jason,

    What settings are you using under Enfold->Performance?

    Best regards,
    Rikard

    #1277954

    Merge & Compress.
    Load only used elements.
    Enable lazy loading.

    I don’t think any of these have an impact on layerslider?

    Link below.

    Cheers,
    Jason

    #1278552

    Hi,

    Thank you for the inquiry.

    We could add the snippet in the functions.php file to disable the settings forced by the theme such as loading the script in the footer, but we are not entirely sure how this would affect the site. Please try this code.

    remove_action( 'init', array( 'Avia_Config_LayerSlider', 'force_settings'), 10, 0 );
    

    Or this..

    add_action("init", function() {
        remove_action( 'init', array( 'Avia_Config_LayerSlider', 'force_settings'), 10, 0 );
    }, 10);
    

    If the above fails, try to edit the \enfold\config-layerslider\config.php, and comment out line 80 or just remove this code.

    add_action( 'init', array( $this, 'force_settings'), 10, 0 );
    

    Best regards,
    Ismael

    #1278578

    Thanks Ismael,

    The first two did not work. The last one did, and improved the load time of the above the fold slider.

    Is it possible for you to include this option in the theme performance settings so we don’t have to resort to a code change? Or provide another snippet for the functions.php.

    Thanks,
    Jason

    #1279019

    Hi,

    Thank you for the update.

    We will forward your request to our channel for further consideration. For the meantime, you may have to keep the modification in order to select the location of the scripts.

    Best regards,
    Ismael

    #1301758

    I am having the same issue and none of these solutions worked for me. https://www.thestrapsaver.com – can you help?

    Thanks!
    Shari

    #1302280

    Hi,


    @sldeutsch
    : Did you add this hook in the functions.php file?

    add_action( 'init', array( $this, 'force_settings'), 10, 0 );
    

    Make sure to purge the cache after adding the code. If it is still not working, please open another thread and post the details in the private field.

    Best regards,
    Ismael

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Enfold LayerSlider loading in footer causing high CLS’ is closed to new replies.