Try Tuts+ Premium, Get Cash Back!
Using WordPress as a Web Application Framework

Using WordPress as a Web Application Framework

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.

Harish Chouhan is hchouhan on Themeforest
Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • as

    I’m always using WP as framework, once i’ve created price comparison website which in real time compares many diferent product pprices from amny e-shops.

    Second one is mp3 selling store. WP is really good, but need time to disable wp dashboard as you want, and not always this is the easy work :)

  • http://www.amrabdelaziz.com amrabdelaziz

    very important lovely tut D:
    thnx so much

  • http://www.haleco.fr bac de rétention

    Interesting, i’ll be very interested of a tutorial on who to manage people with WordPress like Phpnuke did it.
    How to display user, have a chat with connected user, etc…

  • http://twitter.com/_vik vik

    WordPress is a CMS… I use CodeIgnitor for Web Application
    http://net.tutsplus.com/sessions/codeigniter-from-scratch/

    • Jesus Bejarano

      WordPress is considerate a framework as well

  • http://shanegowland.com Shane Gowland

    I was really looking forward to reading ways WordPress falls short as an application framework.

  • Pingback: Using WordPress as a Web Application Framework | Qtiva

  • http://inventikasolutions.com Pritesh

    WordPress works wonderfully as an application framework. I use it to build web apps. It takes care of user management and lets me focus on the main app.

  • schwooba

    Can anyone recommend a good IDE with autocomplete, etc to help develop for WordPress?

    • http://wp.envato.com/ Japh Thomson
      Staff

      Hey Schwooba, there are quite a few IDEs, and ultimately it’s personal choice of your feature priorities. I personally love Sublime Text 2, and you can read a bunch of articles about it over on our sister site, Nettuts+

    • http://www.netbulae.eu Xander

      I also use Sublime Text 2. It is great because of SFTP and it’s terminal. Watch folders and instant sync. Build tools and is compatible with all TextMate bundles.

    • Fery

      same as Xander and Japh Thomson, i love using SublimeText2. but you can also consider about Code Lobster. it’s come with bounch of plugins that make much of your development easy.

      Sorry about my english.

      BTW, thanks for a nice article. ^_^

  • http://migaber.samams.com mohamed gaber

    WordPress is really amazing… converting from a blogging system to a CMS creator system, They know how to change the concept, Thanks for the team thank for the community, really they do the hard work.

  • http://rezaonline.net reza

    Thats true but wordpress can’t be realy framework .

  • Pingback: Using WordPress as a Web Application Framework | Wptuts+ » Web Design

  • http://www.paulund.co.uk Paul

    Nice idea don’t see why not. Some people still see WordPress as a blogging platform but it’s so much more.

  • http://www.tutorial-webdesign.com TutWeb

    WordPress is too weight as web app.
    Wordpress not MVC, all functions loaded at the first time, e.g: you can call all method from template & plugins, so all functions loaded when user visit to your website at the first time :)

    For me WordPress is still blogging platform.

  • http://www.mojowill.com theMojoWill

    I was hoping that your article would actually talk about using WordPress as an Application framework not just reiterate some of it’s features.

    • http://www.harishchouhan.com Harish Chouhan

      @theMojoWill, agreed. However the intention was just to raise the question as to why not WordPress is being used as a Framework. I am sure you would get to read more in-dept tutorials soon on using WordPress as a framework for creating different kind of websites.

  • http://logixstudios.com Brandon

    We’ve used WordPress as an application framework for several projects. Most recently we used it as a framework to develop a production management system for an agricultural business. It allows them to submit order receipts by employee, store distributor and location details (the have multiple locations), and generate yearly, monthly and weekly production reports.

    Much of our code was custom but WordPress provided a quick framework for user management and database interaction. There are several MVC frameworks that we could have used, like CodeIgnitor or CakePHP but the decision was made to use WordPress because of the ability to tie into their public website in the future and develop a suite of applications that all shared the same user management system. We are also integrating it with a couple iOS apps and it’s working great.

  • http://www.piklist.com Steve Bruner

    You may want to try “Piklist”. It’s a rapid development framework for WordPress. Powerful, Flexible and easy to use.

    • http://kmdig.com Michael Keene

      Piklist looks amazing!

  • Pingback: HostNine Weekly Round-Up 7/2 – 7/6 | HostNine Company Blog

  • Michael

    I’m sorry but WordPress just isn’t a framework. In it’s current state it will always just be a blogging platform.

    • http://wp.envato.com/ Japh Thomson
      Staff

      Interesting point of view, Michael. Can you perhaps clarify what you feel WordPress lacks that means it couldn’t be called a framework, or even a CMS, but just a blogging platform?

      Considering many people are using it as a CMS, and more and more as a framework, I think it’s important to qualify your comments :)

    • SamDev

      Again, depending on your skills

  • http://www.komolabs.com Luiz Henrique

    I think that i can use WordPress as an application framework as well. It’s cute as a initial point to build a custom CMS, with your own custom post types, etc.

  • mahabub

    I tried to use wordpress to build a management application, and there has to be a different looking admin panel than the design provided. So that I had to create a plugin and a theme for my project. My question is Is there any way to make a admin panel theme without altering the core codes?
    Thanks.

    • http://memeLab.com.au/ Tim Osborn

      I’m considering creating a ‘front-end dashboard’ for my users, who would never manage the standard WP content, only data managed by my plugin. This way, I can theme the dashboard consistent with my theme.

      I’ve heard it said many times that to altering the standard WP admin is a ball and chain, because it is likely to change often, possibly fundamentally.

  • Pingback: WordPress links of the week (25/Jul/12) | Go Wordpress

  • Pingback: WordPress のブログから CMS への変化と、アプリエンジンとしての最新事例 – ja.naoko.cc

  • Vicky Patil

    Nice to tell that I was thinking in the same way instead of using Zend and codeIgniter.,
    developing custom plugins and themes plus some code in php jscripts etc would make basic wp usable but not for all ., plugins wont change whole or required ways how wordpress works.,

    you have described why to use but did not give any ideas about how to use .??
    just use SublimeText2 or aptana or anything else and change the code thats all you want to say ?
    need something more.,
    better cookies management too

  • http://ileorex.in ravi

    how i can use this framework in my ios application.

  • Dorin

    How can WordPress manage such things as: migrations, schemas, relationships? There is no MVC in WordPress.

    • SamDev

      depending on your coding skills

  • Pingback: Pluginchief

  • Pingback: Tunnel Vision and WordPress as an Application Framework

  • Pingback: WordPress as a Framework or SaaS | Eureka Design Group

  • Geo

    You can use this plugin to easily MVC-ify WP. http://wordpress.org/extend/plugins/wp-mvc/

  • Pingback: Creative Coding Tutorials for get Better WordPress Experience | Piece Of Code