Formerly WordPress is ongoing to build up within the effective blog-system having a effective CMS and, more lately, having a effective framework for web applications. Really, using WordPress personalization features along with the WordPress API, you’ll find very little applications I’m capable of consider, you can’t build. However, there are lots of applications you should not build with WordPress. Selecting which framework to make use of (or selecting to not utilize one) is balancing between many pros and cons affecting architecture, performance, security, scalability and so forth.
I stumbled upon WordPress very helpful as base for medium-sized web apps, without lots of traffic. Creating a small application, for example a restaurant table booking system, on your own or even obtaining a framework like Rails or CakePHP, would involve considering database plan, controller structure, authentication, user interfaces etc. Lots of these items WordPress had been doing: you’ve rough user management, an operating admin interface so you just consider the easiest method to map important data-model for that old WordPress database structure.
Our use situation: A recipe database
Now, If perhaps to exhibit the easiest method to implement an easy recipe database with WordPress. Needs are actually fundamental:
Enables adding recipes and editing them much like ordinary posts or pages
Enables categorizing recipes in hierarchical groups like Healthy -> Chicken -> Marinated Chicken Breasts
Enables adding ingredients having a recipe and finding recipes by ingredients
Enables adding quantities to ingredients in the recipe, e.g. 500ml milk, 20g sugar, 3 tablespoons essential essential essential olive oil
I’ll focus on the way to personalize WordPress to handle it for that data model, usually by demonstrating how you can operate the necessities to produce every WordPress powered web application:
Custom publish types
Setup custom publish type for recipes
In WordPress the feet of each and every content holding entity could be a publish. The 2 publish types you surely understand are posts and pages. For your recipe database we’ll produce a new type: recipes.
‘labels’ => array(
‘name’ => ‘Recipes’,
‘public’ => true,
‘has_archive’ => true,
‘supports’ => array(‘title’,’editor’,’custom-fields’)
The brand-new publish type displays inside the admin interface together with posts and pages. It offers a place for the recipe title along with a editor field that’s intended for the recipes description part. We even added support for custom fields, that’s necessary afterwards.
Setup custom taxonomies for recipe groups and ingredients