Software Engineering in WordPress, PHP, and Backend Development

Tag: WordPress (Page 79 of 219)

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

Sharing Code: A Good Opportunity To Exchange Ideas

In the previous post, I happened to share a screenshot of some source code that was from a 0.1.0 (or, perhaps more appropriately named, an MVP) of a project I’m writing (and it turned out to be a good opportunity to exchange ideas with someone else).

Exchange ideas based on your source code.

Not long after it had gone live, I received a tweet containing the following comment:

Interesting to see how differently people work. There at least four things in your screenshot that I wouldn’t do.

From experience and from being online long enough, I know there are certain segments of our industry who look at something like this and think “Burn – he’s got it down and he’s going to take him to school.

Except not really.

I believe I’ve talked about this in previous posts, but what I’m getting at is when others make comments like this to you, approach it in two ways:

  1. Understand they are coming from a place of [likely more] experience,
  2. Ask what things they would do differently. Odds are they have good reasons and are likely in a position to help you get better at what you’re doing.

Later in the post, I’ll share the entire conversation that took place on Twitter but I think it’s important to mention that, at this point in time, I know the person in question well enough to have both respect and no problem in engaging them in further questions and conversations about things like this.

But it hasn’t always been that way. So for those of you who are getting into sharing your code and learning how to field feedback that comes regardless of the format, then this is primarily for you.

Continue reading

Custom Plugins: What’s Loaded, What’s at the Ready?

The longer I work in building custom plugins for other people, the more I’m convinced of the advantages of maintaining a personal library of classes (or functions depending on your style) that help expedite tasks that are common to every project.

Sure, it can be hard to determine what you’ll require for every project and what you’ll require for some projects.

Custom Plugins and Required Files

And there’s nothing wrong with focusing specifically on the latter, but there are advantages that you have, at the bare minimum, a foundation off of which you can build custom plugins for others without constantly re-writing the same code over and over and over.

And over.

And you get it.

So what are the things that we should have and what are the things we should save, say, at the ready?

Continue reading

WordPress JSON Encoding For Ajax

If you’ve worked with Ajax in any capacity, then you’ve likely tried to send response data using various formats. Obviously, the original format of the response data is XML but JSON is a second, [and arguably] more popular format.

When working with WordPress’ Ajax API, arguably, the most important things to remember are:

  1. Make sure the function is using the proper hook (should it be available for the public, for users who are logged into their account, or both?),
  2. Terminate the function using wp_die unless you want an incorrect or malformed response sent to the client.

In addition to that, if you’re sending your response data to the client in the form of JSON then you have several options on how to return the data:

  1. Structure the JSON data yourself (which I think would be an overly complicated feat 🙂),
  2. Use PHP’s json_encode function,
  3. Or use WordPress’ wp_json_encode function.

You can see there this is going, right? So I’ll make it quick.

Continue reading

Desktop Applications via the WordPress REST API?

There are a lot of reasons that people are excited to have the WordPress REST API merged into core.

The WordPress REST API Plugin

I think some are excited because they won’t need to include the plugin dependency anymore; others, honestly speaking, I think are happy to see it merged for the sake of it. Whatever the case, having the entire infrastructure is core is neat, and I’m excited, but almost none of the client work I’m doing at the moment warrant it.

I believe that will change, though, as people learn what we can do with it. But until that time comes, one of the things I like to do is try to think broadly about what could the REST API offer that isn’t directly related to blogging.

And this leads me to a much broader question.

Continue reading

Learn “WordPress JavaScript” (And What That Means)

Now and then, I’ll stumble across a blog post, question, or comment that talks about WordPress JavaScript as if it’s a different type of or variant of JavaScript that exists solely within the WordPress application.

For those who have been working in web development for a long time, this seems like a silly statement, but if you’re brand new to web development (regardless of your age), then this is something that might be a bit confusing.

After all, it’s not like the JavaScript standard is cut and dry right now, right? But I digress.

Furthermore, WordPress includes jQuery, jQuery UI, Backbone, and so on. So when someone wants to work with JavaScript within the context of WordPress, what are they actually talking about?

And the answer is, unfortunately, “it depends.” But it does: It depends on the type of work you’re doing and where you’re focusing your efforts.

But this brings us back to the original problem: How do you learn “WordPress JavaScript” if you’ve never even touched JavaScript?

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑