sumitpore / mvc-plugin-boilerplate-for-wordpress

An MVC WordPress Plugin Boilerplate with clear separation of concerns. Will make your experience of creating a WordPress Plugin enjoyable!
178 stars 24 forks source link

adding widget the right way #25

Closed thunderjet12 closed 4 years ago

thunderjet12 commented 4 years ago

Hi, Thanks for this awesome boilerplate

I have a question: I'm building a collection of Elementor widgets I what and which the best place or file to register the widgets and enqueue styles and js files. here is my code https://github.com/thunderjet12/sbird-admin

Best regards ^_^

sumitpore commented 4 years ago

Hi,

I would suggest creating a new folder 'widgets' inside 'controllers' folder and create widget classes inside that 'widgets' folder.

I think (not sure) you would have to load these widget classes on frontend as well as on frontend. If that is the case, you would have to use ROUTE_TYPE::ANY in routes.php for those widgets.

thunderjet12 commented 4 years ago

Hi,

I would suggest creating a new folder 'widgets' inside 'controllers' folder and create widget classes inside that 'widgets' folder.

I think (not sure) you would have to load these widget classes on frontend as well as on frontend. If that is the case, you would have to use ROUTE_TYPE::ANY in routes.php for those widgets.

Thanks a lot, ^_^