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

Question: Where should a Custom Post Type class be packaged #173

Closed emeraldjava closed 10 years ago

emeraldjava commented 10 years ago

Hi,

i've used boiler plate as a template for my plugin.

https://github.com/emeraldjava/bhaawp

At the moment I define my Custom Post Type classes in the 'public' area. I placed it here since i expect the default user to be able to view the post type.

https://github.com/emeraldjava/bhaawp/blob/master/public/includes/RaceCpt.php

I then have a second class with custom admin actions packaged here

https://github.com/emeraldjava/bhaawp/blob/master/admin/class-race-admin.php

I'd be interested to get any comments on how bad/good this is and how it should really be done. Would it be better practice for me to merge both classes and package the updated class in the admin area?

Regards,

dashifen commented 10 years ago

That's pretty much how I do it, for what it's worth. You've made classes just for the post types; I don't always do that personally but then again it looks like you've got more than one post type that you're adding so that probably works well to separate them out and keep things clean.

On Tue, Mar 25, 2014 at 2:00 PM, emeraldjava notifications@github.comwrote:

Hi,

i've used boiler plate as a template for my plugin.

https://github.com/emeraldjava/bhaawp

At the moment I define my Custom Post Type classes in the 'public' area. I placed it here since i expect the default user to be able to view the post type.

https://github.com/emeraldjava/bhaawp/blob/master/public/includes/RaceCpt.php

I then have a second class with custom admin actions packaged here

https://github.com/emeraldjava/bhaawp/blob/master/admin/class-race-admin.php

I'd be interested to get any comments on how bad/good this is and how it should really be done. Would it be better practice for me to merge both classes and package the updated class in the admin area?

Regards,

— Reply to this email directly or view it on GitHubhttps://github.com/tommcfarlin/WordPress-Plugin-Boilerplate/issues/173 .

David Dashifen Kees