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

Adding to the Database? #372

Open diggetydog opened 8 years ago

diggetydog commented 8 years ago

Hey Dean. Great structure - I have bean wrapping my head around the templates and structure. Very good commenting. I am a noob to this and had a question. I need to install a database to manipulate. Where is the best place to add install code? includes/class-plugin.php? includes/class-plugin-activator.php?

DevinVinson commented 8 years ago

Add it where it makes sense to you. I would put something like that in the admin class that checks for the db existence, with a method to check for first install/activation etc.

joshuadavidnelson commented 8 years ago

@diggetydog Just as a reference, if you're interested, Pippin Williamson just did a great series on building a database abstraction layer, handy stuff (behind a small paywall, but worth it): https://pippinsplugins.com/series/building-a-database-abstraction-layer/

EdawRellek commented 8 years ago

@joshuadavidnelson thanks for the link. It took me a bit to figure out but it was well worth the time and couple bucks

joshuadavidnelson commented 8 years ago

@EdawRellek Awesome! Happy it was helpful. Pippin's a great resource.