Using Direct Database Queries to Quickly Update Data, Part 1 This is yet another post that's going to be an illustration of how to use $wpdb to quickly update information based on metadata.

This is not the first time I’ve mentioned this, but one of the challenges that come with talking about writing direct database queries to update information in the WordPress database is that you leave yourself open to something like:

Yeah, but there’s an API to do something just like that.

And, in many cases, that’s right. I’m a big fan of using ’em, too. But there are times where direct, parameterized database queries can be a more optimal choice.

Direct Database Queries, Part 1
No, it’s not a database but wouldn’t it be awesome if they looked like this? Photo by Tobias Fischer on Unsplash

This is, of course, contingent on the environment in which you’re working the requirements of your project.

So this is yet another post that’s going to be an illustration of how to use $wpdb to quickly update information based on metadata (without using something like WP_Query or WP_Meta_Query to handle it).

Continue readingUsing Direct Database Queries to Quickly Update Data, Part 1 This is yet another post that’s going to be an illustration of how to use $wpdb to quickly update information based on metadata.

WordCamp Atlanta 2019: Web Apps with WordPress An explanation for why WordPress is a great option for a web application foundation.

I’ve enjoyed speaking at WordCamps since my first back in 2013. You can see a short list of the ones at which I’ve spoken here:

And this weekend is officially WordCamp Atlanta 2019.

WordCamp Atlanta 2019: Web Apps with WordPress

I took 2018 off of speaking for several different reasons, and I’m not planning to do much in 2019 (especially with another kid making her debut later this year ❤️).

But given the work I’ve been doing with WordPress over the past few years, it seemed fitting to apply to at least speak at my local WordCamp.

Continue readingWordCamp Atlanta 2019: Web Apps with WordPress An explanation for why WordPress is a great option for a web application foundation.

Using Functions in Place of Globals: get_post_field Here's an alternative to using functions in place of globals. And it's one of many that we should use as we move forward.

As PHP has continued to move forward and WordPress (and its developer-economy) works to begin using more of the more modern features, one of the things we still see happening is the use of globals within WordPress.

To some degree, it’s inevitable: Significant parts of the application were built using globals when that was the facility that was a primary feature; other parts, though, have moved forward by providing classes or functions that prevent us from needing to do that.

Case in point: get_post_field is a solid alternative to using the $post global that provides much of the same information in a slightly more modern (and arguably safer) way of reading the data.

Continue readingUsing Functions in Place of Globals: get_post_field Here’s an alternative to using functions in place of globals. And it’s one of many that we should use as we move forward.

How to Manipulate the DOM Using PHP Manipulating the DOM on the client-side isn’t always the best option. We can do so using built-in features of PHP.

When it comes to manipulating the DOM, the first thing many of us likely think of is using JavaScript to do whatever it is we need to do.

Not only does the language natively support functions for doing this, newer features of ES6 give us more powerful ways to build client-side scripts. And if you’re using jQuery with WordPress, then you have the same library of functions for, ahem, querying the DOM that we’ve had for years.

But manipulating the DOM on the client-side isn’t always the best option. Instead, you may want to do so on the server-side. And because of some of the features built into PHP, it’s not much different from how we do things using JavaScript.

Manipulate the DOM Using PHP: Manipulate the DOM Using PHP: DOmDocument

Other than, of course, we’re doing so on the server.

Continue readingHow to Manipulate the DOM Using PHP Manipulating the DOM on the client-side isn’t always the best option. We can do so using built-in features of PHP.

Tools for Writing Better WordPress Code: The Composer Lock File Understanding how the Composer lock file prevents us from needing to commit the vendor directory to our repository.

Before wrapping up our discussion on Composer, we have one important thing left to discuss: The vendor directory (and by extension, the Composer lock file).

Specifically, we need to talk about why we don’t need to commit the vendor directory to the repository but how our contributors can be sure they have the latest version of the software needed to work with our code base.

Using code quality tools to write better WordPress code is important, yes, but understanding how to properly manage dependencies and our repository is important, too. So before looking at said utilities, let’s review the lock file, the role it plays, and why we don’t need to commit the vendor directory to our repository.

Continue readingTools for Writing Better WordPress Code: The Composer Lock File Understanding how the Composer lock file prevents us from needing to commit the vendor directory to our repository.