Skip Navigation

[Resolved] JS Problem with Toolset Layouts

This thread is resolved. Here is a description of the problem and solution.

Problem: I see a JavaScript error on the front-end of my site about DDLayout_fe_settings being undefined:

Uncaught ReferenceError: DDLayout_fe_settings is not defined

Solution:
Enqueue plugins in your child theme using proper dependency registration. If a registered script depends on jQuery, it should be noted in the 3rd parameter like so:

wp_register_script( 'custom-script2', get_stylesheet_directory_uri() . '/assets/js/icheck.min.js', ['jquery'] );

Otherwise, the script may be executed before jQuery is loaded.

Relevant Documentation:
https://developer.wordpress.org/reference/functions/wp_register_script/

This support ticket is created 5 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by timM-10 5 years, 5 months ago.

Assisted by: Christian Cox.

Author
Posts
#1321353
Screen Shot 2019-08-21 at 10.03.38 AM.png

I am trying to:

Get my javascript and css styles to load correctly on toolset views, specifically on this page: hidden link

Link to a page where the issue can be seen:

hidden link

I expected to see:

My input boxes rendered with custom styles and javascript i have added

Instead, I got:

Won't load. Console error is traced back to Toolset Layouts plugin. If I deactivate layouts (which i need for other pages), it works normally.

#1321543

Hi, can you try these troubleshooting steps?
- Temporarily activate the parent Avada theme and deactivate all plugins except Types, Views, Layouts, Fusion Core, and Fusion Builder.
- Test again.
- If the problem is resolved, reactivate your child theme and other plugins one by one until the problem returns.
- If the problem is not resolved, I'll be glad to take a closer look. Let me know if it's okay for me to run the tests I described above.

#1322233

Hi Christian. I followed your instructions but the problem persists. It is caused the Layouts plugin from Toolset. If I deactivate Layouts everything works as expected except for the pages I have built with layouts. The console error is the same as I've screenshotted on the original request. This used to work normally.

#1322285

When I switch to the parent Avada theme, most of the errors in the console are resolved. The only one left is about the iCheck plugin, here:

VM331:3962 Uncaught TypeError: $(...).iCheck is not a function
    at loadChecks (VM331:3962)
    at HTMLDocument.<anonymous> (VM331:3975)
    at i (jquery.js?ver=1.12.4-wp:1)
    at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4-wp:1)
    at Function.ready (jquery.js?ver=1.12.4-wp:1)
    at HTMLDocument.J (jquery.js?ver=1.12.4-wp:1)

I assume that's because this plugin is enqueued by your child theme. So this leads me to suspect there is an issue in how you are enqueueing your JavaScript assets. I checked your child theme's function.php file and I can see that your wp_register_script calls do not include any dependencies. If a registered script depends on jQuery, it should be noted in the 3rd parameter like so:

wp_register_script( 'custom-script2', get_stylesheet_directory_uri() . '/assets/js/icheck.min.js', ['jquery'] );

Otherwise, the script may be executed before jQuery is loaded. Please update your functions.php file to include the necessary dependencies for each registered script to prevent these errors from occurring.

#1322291

My issue is resolved now. Thank you!