Tom McFarlin

Software Engineering in WordPress, PHP, and Backend Development

Page 155 of 427

The Single Responsibility Principle in WordPress

Every time I work on a project for a client (or a side project for myself), I try to keep in mind each of the five SOLID principles.

These are often talked about by developers on numerous blogs (and I’ve done so myself on this site), so I’m not about to teach of them in this post.

Single Responsibility: One Reason to Change

Instead, I’ve been looking at how the Single Responsible Principle applies with working with various aspects of the WordPress API. And what I’ve found is that, in my experience, using this principle consistently results is far smaller classes.

My most recent experience has been in a very simple use case: Working with the WordPress API to create a submenu item and a corresponding submenu page.

Continue reading

A Pressmatic Image for WordPress Trunk

As a follow-up to yesterday’s post with using Pressmatic and a copy of WordPress from the Subversion repository, Kiko Doran asked me a good question via Twitter dealing with one of Pressmatic’s nicest features:

First, you can think of Pressmatic templates as preconfigured images that can be used to re-create a development environment. This is useful if you need to create a second or third or ninth install on your machine.

Or, better yet, it’s really convenient to have it available for your team so that you can make sure you’re all running the same image across all development machines.

Still, the question remains: Can you create an image that has trunk installed by default?

Continue reading

Using Pressmatic with WordPress Trunk

Pressmatic 1.0 was released a few days ago (with 1.0.1 made available today).

Pressmatic with WordPress Trunk

There is no shortage of options when it comes to setting up local WordPress development environments. And as with anything, there are pros and cons to each of the available products. Ultimately, this gives us a choice when it comes to setting up our machines for what works best for us.

Since the product entered beta, I’ve been reading tweets and blog posts all about it and ultimately decided to purchase it and give it a try for myself.

Continue reading

Internationalizing WordPress Plugins

Earlier this week, I shared a link to the introduction of a series of articles I’m writing on internationalizing WordPress plugins. The gist of the series is straightforward:

  1. I introduce the concept of internationalization,
  2. I demonstrate how to create a plugin that’s ready for translation,
  3. I then create the translations for a particular locale.

The second part of the series has is available via Envato. As is the case with other articles I’ve written, this post serves as a short description of the article to help determine if the tutorial covers more information you’d like to read.

And as mentioned above, this particular article covers how to write a localization-ready plugin.

Continue reading

Custom Data Validation in WordPress

Custom data validation in WordPress is something that many who have built custom solutions for others have likely used.

In fact, anyone who has made a theme or a plugin has probably used some form of data validation even if it’s just escaping some attribute that will be part of the rendered markup.

Custom Data Validation

This is a major step in making sure that anything you’re creating is securely managing information coming from the database.

But whenever you’re working on a custom solution that requires you use various elements and attributes, how can you specify only the supported attributes?

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑