Software Engineering in WordPress, PHP, and Backend Development

Category: Articles (Page 106 of 258)

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

How To Monitor Your PHP Error Log in MAMP

I’ve talked about reading your PHP Error Log using Console.app in a previous post, and it’s something I recommend reviewing.

Using Console.app to monitor PHP Error Logs

Since that post, though, I’ve swapped to MAMP 4 and have asked my opinion on a variety of its features. Though I plan to do a more extensive post on this in the future, I thought it might be better for me to highlight a few things that are beneficial in shorter posts.

And you know I’m a fan of using a proper debugger, but I still stand by using the error log when working on your day-to-day work.

Continue reading

Setting Up PHP CodeSniffer in Visual Studio Code

This post was last updated on July 31st, 2020 to include the most recent updates.

If you’ve read any of my previous posts, you know that I think code sniffing (as funny as that sounds) is something that I believe to be a staple of any WordPress development environment. And this is how you can setup PHP CodeSniffer in Visual Studio Code.

But first, a word about Code.

Visual Studio Code is a source code editor developed by Microsoft for Windows, Linux and macOS. It includes support for debugging, embedded Git control, syntax highlighting, intelligent code completion, snippets, and code refactoring.

I’ve been using Code as my primary IDE for years at this point and have been extremely happy with it. I’m not going to belabor the points as to why. I’ve written about them in other posts.

But here’s how to set up PHP CodeSniffer in Visual Studio Code.

Continue reading

An Implementation of the Repository Pattern

I talk about design patterns quite a bit on this blog, though I don’t know if I ever really do a good job of doing a deep-dive into individual patterns, why I’ve used them, or even how they are structured.

I’m okay with that as I’m not always aiming to give tutorials on principles and patterns as I am on WordPress-specific programs, but let’s say you’re someone who wants to use a design pattern in WordPress and isn’t sure where to start.

Given all of the above, I thought it might be worth giving a high-level look at how I’m implementing a pattern in a current project – at least at a high level – and then where you can refer to other design patterns for your future work.

Continue reading

Programmatically Add a WooCommerce Variable Product

Adding a custom WooCommerce variable product isn’t something that’s terribly difficult given the hooks that WooCommerce provides, but there’s always a bit of context that helps when giving an example like this, right?

Last week, I shared a small bit of a code that shows how to add a custom input field to a WooCommerce product. And in that post, one of the things I shared what how I like how easy it is to create UI elements using server-side logic.

WooCommerce Variable Product: Creating the UI

And working with variable products is no different. It is, however, a matter of using a different hook.

Continue reading

Use and Abuse Singletons in WordPress

For those who make a living by creating custom solutions for others using WordPress, you likely have your approach to how you structure the foundation of your typical plugin. And I think that’s a Good Thing™.

If you’ve read any of my previous posts, you know that I generally prefer the object-oriented approach to building plugins so there are a number of patterns, common solutions, and architectural decisions that I try to employ from project-to-project.

I’m not dogmatic about it, though:

If something new comes along, I’m willing to give it a try. Similarly, if someone I’ve been using for a while is criticized, I’m willing to take a look but that doesn’t mean I’ll change it.

In short, I need a lot of information to sell my on why I should change something that works, that’s maintainable, and that reads well for other developers.

And one of the points of discussion that comes up periodically is the idea of using Singletons in WordPress development.

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑