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.

Privacy is Hard: Email What if you're looking for private email services that don't parse the information in your inbox to generate advertisements (or other similar functionality)?

A few weeks ago, I started writing about a couple of things related to privacy on the web (which is a topic that I think many of us think about in some capacity).

You can catch up on everything I’ve written about thus far, but this post is going to follow-up with something I mentioned in the previous post.

Specifically, I mentioned a simple alternative for not giving out your email address.

Although Burner Mail works well, I also think it’s worth using third-party services for your standard email, too. After all, it’s worth having your privacy protected there, too, right?

BurnerMail (and services like Throttle) are great for providing temporary email addresses with which you can still access those messages for some time.

Email Privacy: BurnerMail

But what if you’re looking for an actual email service that respects privacy and, say, doesn’t parse the information in your inbox to generate advertisements (or other similar functionality)?

Continue readingPrivacy is Hard: Email What if you’re looking for private email services that don’t parse the information in your inbox to generate advertisements (or other similar functionality)?

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.

Using Custom Filters with Shortcodes Even if you've never used either the API or the functionality before, it's easy to begin implementing custom filters with shortcodes.

Once you understand the Shortcode API and how filters work, it’s easy to implement them in WordPress.

Custom Filters with Shortcodes: Shortcode API

And when you’re able to mix the two, you can do much more than usual than when they are operating independently of one another.

Specifically, you can filter data that are in the result of the shortcode, and this can be especially useful for other developers. If you’re familiar with implementing custom filters, then doing this within the context of a short code isn’t much different.

But if you’ve never used either the shortcode API or the functionality before, it’s still easy to do.

Continue readingUsing Custom Filters with Shortcodes Even if you’ve never used either the API or the functionality before, it’s easy to begin implementing custom filters with shortcodes.

Structuring API Functionality (with a Separation of Concerns) A guide as to how you can move forward in your work with doing structuring API functionality.

I don’t have a lot of experience when it comes to creating APIs. I’ve done a fair share of work when it comes to integrating WordPress with third-party APIs, but I’ve spent very little time working on creating a system that has its API with which other systems can interact.

As far as the latter is concerned, I’m actually in the middle of doing that (and I’m learning a lot). The gist of the project is there’s an iOS app that’s interacting with WordPress via the REST API in a bi-directional way.

Structuring API Functionality: The WordPress REST API

I’m eager to share more about it, but I need to do so when the project is further along.

But when it comes to working with third-party APIs and then building components of a WordPress project that interact with them, two of the things I consistently find useful are:

And the last two points above are what I’m looking to cover in this post.

Continue readingStructuring API Functionality (with a Separation of Concerns) A guide as to how you can move forward in your work with doing structuring API functionality.