Advertisement
Creative Coding

Using WordPress as a Web Application Framework

by

Application Frameworks such as Ruby on Rails, CakePHP, CodeIgniter, etc. are common today. If you have ever used them or read about them you might be aware of their features and how they help to speed up web application development. In this article we will discuss the common features found in most of these frameworks and their similarity with WordPress.


What Is a Web Application Framework?

In plain words, an application framework can be called as a reusable set of code libraries or classes. Frameworks allow designers / developers to focus on their software and business logic rather than general details such as user management, database connection, error logging, caching, user friendly link generation, etc. This helps in reducing development time.

Some of the most widely used web application frameworks are Ruby on Rails, CodeIgniter, CakePHP and Zend. These frameworks are built on MVC architecture to separate various aspects of the application.

As the intention of the article is to only compare these frameworks with WordPress, we will now talk only about frameworks built using PHP as that is also what WordPress uses.


Advantages of Using a Web Application Framework

PHP is a widely used programming language. It has received negative criticism in the past but often not because of flaws. PHP has a small learning curve which makes it easier for anyone new in programming to start using it. This has resulted in some users using shortcuts that made their websites/applications less secure.

As every developer has a different style of coding, using a framework helps in some ways to make sure everyone writes in a standard way and follows conventions.

You will find below a list of some of the features these frameworks offer:

  • User Management
  • Template Engine
  • Error Logging
  • Localization
  • Form & Data Validation
  • File Uploading & media management
  • Image manipulation
  • Search-engine Friendly URLs
  • Session Management
  • Trackback, XML-RPC & APIs
  • Ability to extend using hooks & classes or plugins
  • Automated code execution scheduling
  • Caching

WordPress has most of the above capabilities built-in. So the question is why can’t we use WordPress as a framework? As existing users of WordPress we are already aware of the classes and conventions used by WordPress. Using it for our larger projects would allow us to use our existing knowledge to create bigger and more complicated web applications faster using the tool we love to use.


WordPress Features That Make It an Exciting Tool to Be Used as a Framework:

1. Admin & Dashboard

WordPress undoubtedly has one of the best administration back-ends. This may be one of the reasons general users are able to adopt WordPress so quickly. Well organized menu, dashboard widgets and responsive design definitely make WordPress better than any other framework at least in terms of the backend design.

Adding custom menus or creating separate data entry screens for different data sets (thanks to Custom Post Types) is easy to do.

Dashboard allows a quick overview of the website and its contents and you could also create your own Dashboard widgets using a few lines of code such as:

	// Function that output's the contents of the dashboard widget
	function dashboard_widget_function() {
		echo "Hello World, this id my first Dashboard Widget!";
	}
	// Function that beeng used in the action hook
	function add_dashboard_widgets() {
		wp_add_dashboard_widget('dashboard_widget', 'Example Dashboard Widget', 'dashboard_widget_function');
	}
	// Register the new dashboard widget into the 'wp_dashboard_setup' action
	add_action('wp_dashboard_setup', 'add_dashboard_widgets' );
Google Analytics Dashboard Widget

Good examples of these Dashboard widgets would be the Google Analytics Plugin, which gives a quick summary of the analytics for last 30 days in a small dashboard widget.

The WordPress dashboard design can also be changed using CSS to make it white labeled.

2. User Management & Access Control

One most important aspect of any application is user management and access control. WordPress offers a great user management tool along with ability to extend access control for different sections of the application using Roles & Capabilities.

By default, without even a single line of code, WordPress allows different roles such as Administration (with complete control), Editor, Contributor and Subscriber. Using this mechanism it's easier to extend the level of control you give to a user to manage different sections of the website.

3. Templating Engine

Backend features aside, another important part of any project is to create the front facing part of the website. WordPress has one of the easiest templating systems along with detailed documentation and a growing and active community to help you if you ever get stuck.

As it's not based on MVC – Model-View Controllers it's easier for even designers with zero or basic knowledge of PHP to get started with WordPress.

4. Localization

WordPress has built-in capability to support localization. It also offers dynamic class generation so theme developers can make websites easier to access whether the user reads from left to right or right to left.

5. Plugins

As of today WordPress has 20,105 active free plugins in its directory. There are also thousands of high quality plugins for free and a small fee. Plugins extend the default functionality to offer different types of functionalities ranging from caching, sitemap generation, integration with 3rd party services, multi-lingual site content, etc.

6. Caching

Caching is one of the important aspects of any website or web based application. It helps reduce server load and increase speed of a website. WordPress offers a simple caching mechanism that can be activated using just few lines of code and for users who want more control, there are plugins that provide complete controls on the way a website is cached and also offers integration with 3rd party content delivery networks.

7. Search-Engine Friendly URLs

WordPress offers user friendly URL generation using just few clicks and it's well integrated with the rest of the content generation sections.

8. File Uploading & Media Management

WordPress has one of the best uploading and media management functionalities. It does not offer funky image manipulation like Instagram, but it does offer most used features.

With drag and drop uploading, thumbnail generation, connection between a data item such as 'Post' with multiple images, automated gallery creation, WordPress does offer a decent feature list for media management.

9. Hooks, Actions & Filters

WordPress offers many hooks that allow developers to call functions at specific times. These are used to add CSS & JavaScript to the web page's head tags, adding an advertising banner at the end of a post, etc.

10. Error Logging

PHP has a standard error log system which can be activated in WordPress by placing the below lines in your wp-config.php:

	@ini_set('log_errors','On');
	@ini_set('display_errors','Off');
	@ini_set('error_log','/home/example.com/logs/php_error.log');
	/* That's all, stop editing! Happy blogging. */

11. XML-RPC & APIs

WordPress supports XML-RPC which allows remote publishing of data on the website. Currently this is widely used only for remote publishing from a weblog client to a WordPress website, however consider it as something that would allow your desktop applications to communicate with your web based application.

12. Multiple Instances

One of the best features of WordPress has to be WordPress Multisite. It allows you to run multiple instances of WordPress from a single set of core files. This could be used to create either multi-lingual websites, country specific instances of an application or it can be used to also create something as dynamic as Shopify.com with a network of online shops. This is what WordPress.com runs on too.


WordPress was created originally as a blogging application. However for the last few years, talented people in the WordPress community have customized and used it to build not just blogs but portals for newspaper websites, real estate themes, forums, and question & answer sites, as well as many, many more varied websites.


Conclusion

When choosing WordPress you should also be aware of the limitations of WordPress. WordPress is feature rich and hence when using as a base for larger applications, you would have lot of features at your fingertips. However if your requirements demand lot of customization and have interconnection between too many distinct data types than perhaps WordPress would not be the best option.

If you used WordPress as more than a CMS, please share your project with us and tell us what's unique about it, in the comments below.

Related Posts
  • Code
    Creative Coding
    Using WordPress for Web Application Development: A ReviewApplication foundation 400
    Over the past few months, we've been taking a look at all of the features and aspects that make WordPress a potential foundation for application development. In fact, we've spent roughly 15 articles talking about all that WordPress offers. And though we'll be reviewing each of the points in this email, perhaps the biggest thing to take away that building web applications using WordPress is different than using many of the popular frameworks that are currently available namely because WordPress isn't a framework.Read More…
  • Code
    Creative Coding
    Using WordPress For Web Application Development: Available Features, Part 7: CachingApplication foundation 400
    When it comes to building web applications, one of the most important things that we have to constantly be mindful of is performance. As they say, performance is a feature. And regardless of if you're a designer, developer, or a user, you know this intuitively to be true: When it comes to applications, we hate waiting. We get frustrated when things don't perform fast enough, or we have to wait longer than we believe that we should.Read More…
  • Code
    Creative Coding
    Using WordPress For Web Application Development: Available Features, Part 6: URL Rewriting (or Routes)Application foundation 400
    One of the nicest things about modern web application development frameworks is that they provide a way to generate really clean routes—or URL schemes—that map to the conceptual model of how the application is structured.Read More…
  • Code
    Articles
    WordPress Initialization Hooks: Benefits and Common MistakesHooks
    In programming, initialization of data is important as it's where we setup the prerequisites for the application such as its attributes, its required files and data, its connection to the database, and so on. WordPress itself has a well-defined initialization procedure. Through the page life cycle, WordPress fires a number of actions many of which we've covered in previous articles. To that end, it provides a set of initialization hooks which are naturally used to initialize the application before executing its primary functionality. As plugin and theme developers, it's important to understand the use cases and common mistakes of these initialization hooks, in order to build quality applications. In this article, we are going to take a look at the importance of WordPress initialization hooks and how they are used in various scenarios.Read More…
  • Code
    Creative Coding
    Using WordPress for Web Application Development: Features: EmailApplication foundation 400
    One of the major components of every web application is its ability to send email. Now this doesn't mean that each web application is its own mail client (though people do certainly create their own). Instead, I mean that applications normally send emails when a user signs up, a user modifies their password, when something in the system changes, or - more generally speaking - whenever something occurs for which the site owners want to notify the users.Read More…
  • Code
    Creative Coding
    Using WordPress for Web Application Development: Features: SessionsApplication foundation 400
    In this series, we're taking a look at how it's possible to build web applications using WordPress. Thus far, we've talked about how WordPress is a foundation (rather than a framework), its architecture, how we need to conceptually think of it when approaching it especially coming from other languages, and then we began talking about the components that make up a basic web application.Read More…