Software Engineering in WordPress, PHP, and Backend Development

Tag: WordPress (Page 84 of 219)

Articles, tips, and resources for WordPress-based development.

Ajax in WordPress: The Server-Side Ajax Protocol

When you’re implementing a protocol, you have to think about server-side ajax functionality and client-side Ajax functionality.

Though they work together to create a complete feature, they have to implement a protocol. And the way they implement the protocol is a bit different depending on which part of the application you’re focused on creating.

That is, the server-side is going to implement functionality and the protocol in one way, and the client-side is going to have its implementation on how it handles the response from the server.

Continue reading

Ajax in WordPress: Protocol Syntax

The Ajax protocol syntax is something that was briefly mentioned in the first post in this series. One of the things mentioned is that a protocol required:

Syntax which should be consistent.

That is, it’s not something that’s defined for us. On the contrary, we have the ability to define the Ajax protocol we want to use on a project-specific basis. I’m a fan of this because I find that different projects call for different semantics (in a number of ways, protocols not excluded).

Ajax Protocol Syntax: The phone

An early protocol. Kind of awesome. Product of a bygone era.

But, if you so choose, you can implement the same protocol syntax across your entire set of projects (though I’d find it difficult to think one protocol would match all use cases).

Regardless, this post will cover the first step in establishing an Ajax protocol syntax that you may (or may not) use in a WordPress project.

Continue reading

Ajax in WordPress: A Series on Protocols

Ajax in WordPress is one of those APIs that’s easy to work with (assuming you understand the fundamentals).

Ajax in WordPress: Protocols

A highly technical illustration of Ajax.

For the most part, it’s as simple as:

  1. Defining a function on the server-side and hooking it to the proper WordPress hook,
  2. Setting up JavaScript to make a POST or a GET request to the particular function,
  3. Handling the response on the client-side once the function as returned it.

Sure, there are things like localization and security that matter but they aren’t as difficult to implement as you might think. These topics are outside the focus of this post, though.

Instead, one of the things that I usually implement is a simple protocol of sorts to help when handling response information from the server.

In short, I’m talking about the idea of using a protocol, of sorts, when using Ajax in WordPress. And it sounds like a more complicated concept than it is.

Continue reading

WordPress Requests and Our Responsibility

WordPress requests (that is, page requests) are something that can become a bit of a hot topic for those who are concerned about the performance of web applications.

Case in point: Last week, I was having a conversation with a friend who, at one time, was doing a lot of work with WordPress and has since moved into another industry of web application development.

During the conversation, he made the following comment:

And the fact that it doesn’t min / cat files instead of [25] network requests is just plain dumb. And when a person has 23 plugins, that’s 26 files not even including the theme and core.

I adjusted the number above to reflect how this particular site performs with my current theme and my [admittedly small] set of plugins.

Page Requests: 25 for this site alone.

25 Wordress requests for all resources for this site alone (along with a JavaScript error).

And though the comment is meant to be humorous and a bit facetious, I don’t think it’s worth dismissing.

In fact, I believe that it’s something worth considering even if we’re simply building things on top of WordPress (versus working on WordPress core).

Continue reading

Using Package Tags in WordPress Development

Using Package tags in WordPress (that is, the @package tag that you see in code comments) is one aspect of plugin development that I call into question. And it’s not because of others who have written any given plugin; it’s coming from my experience (or lack thereof).

When I first got into writing WordPress plugins, I wasn’t using features like namespaces mainly because of the mixed messages I’d received regarding PHP versions, support for them, and so on.

So I did the next best thing and used the @package tag as defined in the phpDocumentor manual and that I’d seen so many other plugins doing in their source code.

But I noticed a conflict: There is a disconnect between how plugins are using them and how the manual defines them.

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑