Once upon a time I tried to build a theme and plugin store into the WordPress dashboard. Kind of like iTunes for WordPress. I called it WP App Store. Long story short, it didn’t work, I started this company (Delicious Brains Inc.), and the rest is history. Maybe you already knew that. But did you know that the store itself was a custom app built on WordPress? Yup. I used a few common plugins but mostly it was a lot of custom code. The entire ecommerce system was custom.1 I learned a lot. One of the most important things was why it is sometimes necessary to use custom tables in WordPress. In fact, I wrote a blog post about it at the time. It wasn’t long after that I stopped working on WP App Store, but I did write some code for managing custom tables, a very simple object-relational mapping (ORM). If you’re not a fan of static methods, you’re probably not going to like the following code much. The use of static methods was inspired by a custom CMS that I had worked with in the past. First, I should warn you that this class requires PHP 5.3+ due to the get_called_class() function. The class provides CRUD methods to operate on a custom table. It is an abstract class, intended to be extended
Share This