Software Engineering in WordPress, PHP, and Backend Development

Category: Articles (Page 95 of 258)

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

How To Get a WordPress Taxonomy By Term ID

Occasionally, when working on a project there are times in which it’d be nice to have an API function to help achieve whatever it is that needs to be done. Case in point: the ability to retrieve a taxonomy by term ID.

Get a Taxonomy By Term ID

Granted, it’s not a hard thing to do, but having the ability to retrieve the information from pre-existing functionality is always nice.

But when that’s not possible, we write our own way to do it, right?

Continue reading

Namespaces and Autoloading in WordPress

In my talk for this year’s WordCamp Atlanta, I’m going to be talking about namespaces and autoloading in WordPress.

Namespaces and Autoloading in WordPress

When I don’t yet have the images I want for my presentation, I use stock photos.

While working on my presentation:

  • I’ve been working on a project for someone in which I’m writing an autoloader from scratch,
  • I’m talking with other developers about their preferences with writing autoloaders,
  • I’m looking at open-source projects to see how others are writing autoloaders.

All of this is primarily done to see how, if it isn’t obvious, others implement namespaces and autoloading in their projects. What’s interesting is that there seem to be three main ways in which people go about doing it.

Continue reading

Manipulating WP Admin Bar Styles with Events

I’ve mixed feelings about the WordPress admin bar, but that has to do with how third-party solutions add their options to it (plus, it can be disabled if you’re not a big fan of it).

Recently, I published a small plugin – meant primarily for developers – that allows users to toggle admin notices whenever they are working with WordPress (ideally in their local environment, though it can be installed anywhere WordPress is installed).

WP Admin Bar Styles: Toggling with Events

The plugin is simple:

  • It introduces an item into the WP admin bar,
  • When you click on an item, it will toggle any notices or messages that are displayed,
  • When you click on it again, it will toggle their visibility.

But there’s a small nuance that I think is worth covering and that has to do with manipulating the WP admin bar styles using client-side code.

All of this is covered in the initial post, but one aspect of the code that I think is worth sharing for those working with the admin bar and those working with JavaScript.

Continue reading

How Do I Know When to Hire Someone?

Last week, I talked a little bit of how I schedule my time on a per week basis with a team of other people and the whole idea of “less, but better” from Essentialism.

When To Hire Someone: Scheduling Time Plays a Role

Though this isn’t a regurgitation of that post (because that’d be dumb 😇), it is a meant to show one way in which I go about doing that when there are some projects, project management, presentations, and other responsibilities all happening at the same time as I’m writing this post.

So what are we do to when our plate is full of things to do, and we’re not sure how to manage the time and responsibility? Perhaps that’s how we know when to hire someone.

Or maybe not.

Continue reading

Find The Difference in Dates Using PHP (and WordPress)

Working with dates in PHP is one of those things that you either have a good handle on, you’re working on understanding, or you’re stuck in the rabbit hole of the documentation that’s in the manual.

Difference in Dates Using PHP: The PHP Manual

If you’re working with WordPress, though, the chance that you’re going to need to work with dates is quite high. Nearly everything that we publish has at least one date associated with it.

This includes post, pages, custom post types, revisions, drafts, and so on.

Furthermore, there’s a chance that custom work that you need to develop with require that you find the difference in two dates using PHP. And though there are multiple ways of doing this, there’s a process that I’ve been following for something.

Continue reading

« Older posts Newer posts »

© 2026 Tom McFarlin

Theme by Anders NorenUp ↑