DevinVinson / WordPress-Plugin-Boilerplate

[WordPress] A foundation for WordPress Plugin Development that aims to provide a clear and consistent guide for building your plugins.
http://wppb.io
7.66k stars 2.25k forks source link

Possible wp_enqueue_script() comment improvment #592

Open diniciacci opened 6 months ago

diniciacci commented 6 months ago

Hello,

I found this comment:

https://github.com/DevinVinson/WordPress-Plugin-Boilerplate/blob/a8291082b5fd23bb84541e7c4089feaa1e99e597/plugin-name/public/class-plugin-name-public.php#L65

a bit misleading.

My point is that the comment uses "should", where it can be made more clear that an instance of that class is indeed passed. I.e. the inexperienced reader does not have to do it, it's already done even if the function is for "demostration purposes only". Moreover it's not the run() function creating or passing the instance.

A very cheap proposal is (need english rework):

        /**
         * This function is provided for demonstration purposes only. 
         * It will add_filter() the default plugin script or sytle.
         *
         * With the current plugin structure, an instance of this class
         * is created by Plugin_Name and then passed to add_action()
         * defined in Plugin_Name_Loader.
         * 
         * Then, the run() function defined in Plugin_Name_Loader will
         * connect all the hooks you have registered with add_action()
         * in the plugin with wordpress hooks by calling add_filter()
         * on each.
         * 
         */
guri-dev commented 4 months ago

@diniciacci I've created a PR regarding the comment that you have mentioned-above Thanks