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.62k stars 2.25k forks source link

Link between Plugin Admin and Plugin Public [ Extends from A class ? ] #555

Open ahsynv opened 3 years ago

ahsynv commented 3 years ago

Hi,

We are using this boilerplate for many plugins, but everytime we need a custom solution to have the same function in the Admin and Public class. Is it possible to add some support by default like : ( "UTILS" below can be juste a PLUGINNAME_Utility or other, its just an exemple )

PLUGINNAME_Public extends UTILS ...

and

PLUGINNAME_Admin extends UTILS ...

? Because sometimes we need to use the same fonctionnality in theses 2 Classes. Thanks

otakupahp commented 3 years ago

To overcome that, I usually create a static helper class that could be used in both.

I also modified the loader to autoload the classes

ahsynv commented 3 years ago

To overcome that, I usually create a static helper class that could be used in both.

I also modified the loader to autoload the classes

Yes its what we do too but its repetitive 😕