pixelgrade / gridable

The Missing WordPress Grid Content Editor
GNU General Public License v3.0
9 stars 2 forks source link

Fixing some errors from Gridable #81

Closed rubengc closed 6 years ago

rubengc commented 6 years ago

Already explained on WordPress.org: https://wordpress.org/support/topic/fixing-some-errors-from-gridable/

vladolaru commented 6 years ago

Thank you @rubengc. I will put your suggestions here for easier reference:

  1. Gridable at frontend miss the javascript var gridable_params

I checked it and is loaded just on backend, changing the hook: add_action( 'admin_head', array( $plugin_admin, 'my_add_styles_admin' ) ); To: add_action( 'wp_head', array( $plugin_admin, 'my_add_styles_admin' ) ); And removing the check is_admin() fixes the issue

Also, is required to print the footer templates, so replacing the hook: add_action( 'admin_footer', array( $plugin_admin, 'wp_print_grider_tinymce_templates' ) ); To: add_action( 'wp_footer', array( $plugin_admin, 'wp_print_grider_tinymce_templates' ) ); Fixes it too

  1. Gridable scripts requires (and I don’t know why) the wp-color-picker on their js and css assets, removing this requirements will enqueue correctly the plugin assets and everything will work as expected
vladolaru commented 6 years ago

Regarding 2, the public facing script (gridable-scripts only has jQuery as dependency).

The admin scripts are only needed when in an editor context, not on the frontend of your site. That is why they are binded to admin_head and not wp_head.

If someone would need editors in the frontend, some minor custom coding to also enqueue the scripts via wp_head would do the trick. But this is not the common scenario and we would load things needlessly on the frontend for the majority of users.