WordPress-Plugin-Boilerplate icon indicating copy to clipboard operation
WordPress-Plugin-Boilerplate copied to clipboard

$hook attribute in action 'admin_enqueue_scripts'

Open aurovrata opened this issue 8 years ago • 7 comments

Include $hook attribute in action 'admin_enqueue_scripts' call function, file changed: class-plugin-name-admin.php (line: 85).

This allows the filtering to specific admin pages to ensure js/css files are only loaded where they are needed. For more info, refer to codex: https://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_sc ripts

aurovrata avatar Sep 16 '16 08:09 aurovrata

https://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts

cliffordp avatar May 19 '17 22:05 cliffordp

Used this in the new, actively maintained fork https://github.com/TukuToi/better-wp-plugin-boilerplate Also added doc block.

smileBeda avatar Jul 05 '21 15:07 smileBeda

@TukuToi did you include it in the new fork? Otherwise, I'd be happy to do a PR on the forked project to included this.

aurovrata avatar Jul 06 '21 13:07 aurovrata

@aurovrata - yes, as stated here https://github.com/DevinVinson/WordPress-Plugin-Boilerplate/pull/400#issuecomment-874177249, it is already included. Also see https://github.com/TukuToi/better-wp-plugin-boilerplate/blob/4f612c6795b7da060db6842a2567714ed024af24/plugin-name/admin/class-plugin-name-admin.php#L73

Thanks a lot for this.

Please feel free to commit any other change you see fit to the new fork, I will be actively maintaining and already added a bunch of missing things.

BTW, as well a new generator plugin is underway for developers to generate their own boilerplate based plugins, see fork main readme for details (it is in early development stage but already functional).

This will allow people to basically generate their own boilerplate, and use the generator with their own boilerplate as start-point.

smileBeda avatar Jul 06 '21 14:07 smileBeda

Please feel free to commit any other change you see fit to the new fork, I will be actively maintaining and already added a bunch of missing things.

nice. I have already bookmarked your repo for future plugin dev. If I come across some additional changes I will do a PR and happily contribute.

BTW, as well a new generator plugin is underway for developers to generate their own boilerplate based plugins,

sooper! A plugin to generate a plugin! Smart!

One thing which could be interesting to develop would be to build custom plugin generator. I create a lot of plugin extensions for the CF7 plugin and there are certain boilerplate code which would be nice to pre-include when creating a new plugin. I imagine I could fork your plugin generator and add custom php code that would be included when I use the forked plugin.

aurovrata avatar Jul 06 '21 14:07 aurovrata

@aurovrata - actually a fork wont be needed! :P You can simply replace the source in the source folder of the Plugin Generator plugin I created. You can check the first commit and readme here https://github.com/TukuToi/tukutoi-plugin-generator

Soon this will be on WP Org as a plugin and you will be able to basically place any thing you want into its source folder, fill out the form and submit it, to generate your full custom plugin. Only thing to follow will be to use the same "placeholders", but of course you could modify that (however, this yes would require a fork, or some additional backend settings which maybe a v2 could hold).

I suggest to follow

  • for Better WordPress Plugin Boilerplate Discussions and Ideas https://github.com/TukuToi/better-wp-plugin-boilerplate/discussions
  • for Better WordPress Plugin Boilerplate Bugs and PRs https://github.com/TukuToi/better-wp-plugin-boilerplate/ (usual git process)
  • for the Plugin Generator plugin, instead follow https://github.com/TukuToi/tukutoi-plugin-generator

smileBeda avatar Jul 06 '21 14:07 smileBeda

thanks for taking the time to provide all these details.

I suggest to follow

done! I have a few ideas on how to improve the general boilerplate code, but I will first experiment with your forked version and come to contribute to the ideas/discussions.

aurovrata avatar Jul 06 '21 15:07 aurovrata