-
AuthorPosts
-
February 1, 2021 at 8:39 am #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?
February 2, 2021 at 9:37 am #1277014Hey Jason,
What settings are you using under Enfold->Performance?
Best regards,
RikardFebruary 5, 2021 at 12:03 pm #1277954Merge & Compress.
Load only used elements.
Enable lazy loading.I don’t think any of these have an impact on layerslider?
Link below.
Cheers,
JasonFebruary 8, 2021 at 6:46 am #1278552Hi,
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,
IsmaelFebruary 8, 2021 at 9:28 am #1278578Thanks 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,
JasonFebruary 9, 2021 at 12:07 pm #1279019Hi,
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,
IsmaelMay 22, 2021 at 5:53 pm #1301758I am having the same issue and none of these solutions worked for me. https://www.thestrapsaver.com – can you help?
Thanks!
ShariMay 25, 2021 at 8:03 pm #1302280Hi,
@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 -
AuthorPosts
- The topic ‘Enfold LayerSlider loading in footer causing high CLS’ is closed to new replies.