Using WordPress as an Application development Platform
Over the past few years, WordPress has evolved from being the most popular blogging platform to the most popular Content Management System (CMS). More and more companies are adopting WordPress as the framework of choice, for building their online corporate identity using web sites and web portals. Some of the top brands using WordPress include Sony Music, eBay Inc., Xerox, Bata, Quartz, Time Inc., BBC America, The New Yorker, and many, many more.
As the framework evolves, with each new update to the underlying platform adding more features and capabilities, and with more and more developers using the platform to solve complex business problems, WordPress is slowly but surely emerging as an option for basing development of large web applications.
Some of the top factors for choosing WordPress as a web application development platform are as follows –
1. Simplified development– A large number of standard and stable core modules are available out-of-the-box for handling common functionalities such as user management, file management, templating, database management, routing, API calls, caching, scheduling, etc.
2. Rapid development process –Using themes and plugins, a developer can easily and quickly get most of the basic functionality for an application up and running very fast.
3. Comprehensive Admin – WordPress provides a very comprehensive administration interface with ability to manage each and every aspect of the application.
4. Quick Learning Curve – Above all, the platform boasts of excellent documentation and community support which makes life simpler for any developer.
Let’s look at an example application to showcase how using WordPress simplifies the development process. Technologies we will be using include WordPress 4.3.1, MySQL, PHP, Apache SOLR.
The objective of the application is to develop a portal that will be used by students and parents to search and find suitable colleges and courses. The primary aspect of the application will be to store data related to colleges such as college name, location, year established, placement services, faculty details, website URL, contact person, etc. Course information would include, course name, fee, eligibility, duration, etc. We will be using Apache SOLR as a search server to index the data.
If we had been developing this as a standard custom application, we would have stored the two entities – college and course in separate tables.
Figure 1: DB structure, classic application approach
However, since we are using WordPress to develop the solution, we will be storing the two entities within the wp_posts and wp_postmeta tables as key-value pairs. I am not delving into the scripts used to upload data since those are trivial.
Figure 2: wp_posts table, WordPress approach
Figure 3: wp_postmeta table, WordPress approach
The above figures 2 and 3 show a college entity stored across posts and postmeta tables. As you can see, the master record is stored in wp_posts and the detail/child records are stored as key value pairs in wp_postmeta table.
Another approach could have been to store these in custom tables, with reference in wp_posts. However, that approach would not work. This is so because, we are using WPSOLR plugin (https://wpsolr.com/) to index the data. WPSOLR is a powerful plugin, which automates the indexing of all WP data into Apache SOLR.
Figure 4: WPSOLR plugin settings
However, it does so only on standard WordPress tables and not custom tables. This comes with the advantage that you do not need to write any schema for the indexing operation – the plugin ships with a standard template schema which does all the heavy lifting into SOLR for you!
Here’s a screenshot of the data indexed into SOLR.
Figure 5: SOLR search showing data index via WPSOLR plugin
UsingWordPress significantly reduces the effort needed to develop the core functionality, which is storing and retrieving data from SOLR.
There are many more plugins/feature-sets available with WordPress, which help in reducing the development life-cycle of large projects. The key is to identify and adapt the various modules/tools/techniques available with the framework and use them wisely to achieve the end objective of the application.