tonik / theme

Tonik is a WordPress Starter Theme which aims to modernize, organize and enhance some aspects of WordPress theme development.
http://labs.tonik.pl/theme/
MIT License
1.33k stars 140 forks source link

Gravity Forms doesn't load required assets #87

Closed code23-isaac closed 5 years ago

code23-isaac commented 5 years ago

Hi,

Gravity Forms is not automatically loading the files it requires (as it should) - for instance if you have a date picker in your form, it should load datepicker.min.js and datepicker.min.css files from the plugin directory, but this isn't happening. I've had to enqueue gravityforms.min.js manually in assets.php to get form ajax to work.

Changed theme to Twentynineteen to troubleshoot and it behaves as expected.

Am I missing something here?

P.S. Thanks for all your work on this great starter theme!

multiplehats commented 5 years ago

Are you sure this is due to Tonik and not an error in your code? I have a site with 30 plugins and haven't run into this problem yet.

code23-isaac commented 5 years ago

After a bit more digging and testing, yes in fact nothing is amiss here.

From the GF docs:

When embedding a form via a function call you must also manually include the necessary Gravity Forms related Javascript and CSS via the built in WordPress enqueue capabilities. Gravity Forms does not include these by default when calling a form via a function call and they are necessary for forms that contain conditional logic or the date picker field.

Solved by calling gravity_form_enqueue_scripts() within the register_scripts() and register_stylesheets() functions found in assets.php.