Software Engineering in WordPress, PHP, and Backend Development

Category: Articles (Page 148 of 258)

Personal opinions and how-to’s that I’ve written both here and as contributions to other blogs.

Ajax in WordPress: Custom Response Messages

I’ve talked about Ajax in WordPress in previous posts and it’s pretty well-documented in the Codex, so I don’t want to belabor the point on how to actually implement it.

Ajax in WordPress

Instead, the point of this post is to discuss how to implement custom response messages – or custom error messages – so you’re able to try/catch or gracefully handle the case when a request to the server fails.

That is, given the examples in the previous links we know how to implement Ajax in WordPress, but how do we handle the cases when something goes wrong? It’s not enough to simply write something out via console.log – after all, that’s meaningless to the user – but wouldn’t it be nice to actually display some type of message to let the user know what went wrong and how they can address it?

Continue reading

What Is the Assets Directory?

Last week, I wrote a short post asking What Is the Vendor Directory? which yielded a number of great responses, but it also resulted in a number of different questions, all of which were related, but none of which could be covered in that specific post.

For example, the article asked?

  • When do I know when to use a lib directory versus a vendor directory?
  • Should the vendor directory sit in the root of the project or should it exist in the root of, say, the JavaScript directory?
  • What about an assets directory?
  • Can lib and vendor co-exist?

And though some of these were answered in the comments and some of these answers can be found elsewhere, it did result in another question about the assets directory.

Continue reading

Drafting Pseudocode Before Building Anything

The longer we work with a given library, framework, set of APIs, or whatever, the more comfortable we get with solving problems using them.

It’s a natural by product of experience, isn’t it?

But that doesn’t mean we’re solving the same problems over and over again. Sometimes, sure, we might be solving a problem like we’ve done previously. And really, in those instances, we should have libraries ready to plug into our work, but that’s content for another post.

Other times though, we may be working with the same foundation to solve new problems.

And that’s where it gets to be a little more touchy:

Because of our familiarity with the tools with which we’re working, we think we’re ready to jump in and solve the problem.

That’s not really the case though, is it? I mean, we might be working with the usual toolset, but we’re still solving a unique problem.

And in that case, shouldn’t we be taking a few steps prior before jumping into our IDE?

Continue reading

Pulling Back From Progressive Enhancement

One of the terms we hear a lot in web development is “progressive enhancement.” If you’re new to web development, Wikipedia defines it as follows:

Progressive enhancement uses web technologies in a layered fashion that allows everyone to access the basic content and functionality of a web page, using any browser or Internet connection, while also providing an enhanced version of the page to those with more advanced browser software or greater bandwidth.

Perhaps another way of looking at it is you introduce a basic feature such that it functions without any of the newer-ish technologies – such as Ajax – and then progressively enhancing the feature so it works a bit more smoothly (or flashier, because that’s a proper term).

Ultimately, it should improve the user experience without compromising the feature for those who don’t have access to newer technologies.

But there’s a challenge those who have been in development for a while tend to face.

Continue reading

What Is the Vendor Directory?

With the rise of package managers, build tools, and other similar software being brought to WordPress, we’re seeing more advanced directory structures in both our themes and our plugins.

Some of these tools have been around a long time – at least in one form or another – as it relates to software development, but it’s still relatively new with respect to WordPress.

If you’re new to WordPress development or you’re new to some of the various tools we have at our disposal for working on these types of projects, then it’s easy to get overwhelmed with some of the organizational choices of said projects.

Relax: that’s normal. It’s a natural part of the learning curve.

Though there’s a lot that can be talked about with respect to all of this, I thought it might be worth tackling just one aspect of it in this particular article.

Continue reading

« Older posts Newer posts »

© 2026 Tom McFarlin

Theme by Anders NorenUp ↑