A couple of weeks ago, I shared a post on Improved Ajax in WordPress. It provides a link to a tutorial that I wrote for Envato that shows how to incorporate Ajax into your WordPress project using procedural programming.

But not everyone who write solutions on WordPress uses procedural programming. Or you may prefer to write code using object-oriented techniques.

Whatever the case, including Ajax in WordPress is not limited to procedural programming.

To follow-up, I also wrote how to do the same thing in object-oriented programming.

Ajax in WordPress via Object-Oriented Programming

Though the actual functionality of the plugin mimics it’s procedural counter part, the approach is different.

Object-Oriented Ajax in WordPress

In the post, I walk through the following topics:

  • Planning the Plugin
  • Organizing the Files
  • Creating a dependency loader
  • Writer the Ajax handlers
  • Creating a main class
  • Writing a bootstrap file for starting the plugin

The tutorial has all the code that goes into the plugin. This includes comments for what each class, function, and attribute is doing.

Furthermore, it explains the logic behind each class’ design and why the decisions were made.

Comments on this post are closed. If you'd like to comment, then please see the original post.

Category:
Articles
Tags:

    Leave a Reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.