Tom McFarlin

Software Engineering in WordPress, PHP, and Backend Development

Page 232 of 427

Using WP_Query To Search For a Person

One of the most powerful features of WP_Query is that it allows for us to create a type of mini-search engine within the context of our WordPress projects.

No, this isn’t as sophisticated as something or someone who’s actually in the search business, but you can create some pretty elaborate queries using WP_Query.

Conversely, you can also create some pretty simple queries that do a good job of returning a subset of data. For example, say you’re interesting in using WP_Query to search for a person. There may be a little bit of criteria that the user has to provide, but doing something like this is usually really easy.

Continue reading

Maintainability of WordPress Theme Customizer Code

When working with the WordPress Theme Customizer, one of the things you may find yourself doing is writing out inline styles into one of the templates for your theme. Most likely, this will happen within the context of your header template since that’s where most of your styles and JavaScript sources are included.

Sure, it’s possible to handle a lot of the work via JavaScript and to use separate stylesheets to handle the general styles, but if you’re looking to set something up like, say, backgrounds that can be selected via the Theme Customizer, then you’re going to need to write out inline styles.

And if you’re in the habit of keeping your code separated such as styles reside in CSS files, behavior functionality resides in JavaScript files, and templates hold markup and PHP, then this can be a little bit annoying. It breaks the trend, you know?

There is somewhat of a solution to this, though.

Continue reading

My Perpetual State of Discomfort

You know that feeling of when you look back at code that you wrote a few months ago and kind of cringe that that’s how you wrote it and sense of “What was I thinking?” or maybe even a little embarrassment comes over you?

I’m beginning to wonder if that’s not something that stays with you as you move throughout your career in development. One thing that I’ve been noticing about myself (and I know at least a few others have this feeling to) as it relates to programming is this:

I am in a perpetual state of discomfort.

Maybe that sounds a little grandiose or maybe it sounds even a little ridiculous, but I don’t know how else to explain it. I look at stuff I’ve done and see how I would do it now, and I work on stuff now and know that, given my track record, I’ll probably look at it later and think about all the ways in which I could refactor it.

It’s kind of a vicious cycle, isn’t it?

Continue reading

The Shelf Life and Feature Creep of a WordPress Theme

With Mayer about to turn a year old (they grow up so fast), with a healthy backlog of features sitting in the queue, and with two other themes sitting in the planning stage for the first part of this year, I’ve been thinking a bit about WordPress themes as a whole.

Sounds like I have too much free time doesn’t it?

But seriously, one of the things that I do wonder about is how long a WordPress theme can actually be sold and continue to be viable for users especially since design trends change. Additionally, I think that there are times in which a theme has reached the maximum number of features it can justifiably offer before it just begins to feel a bit crowded.

Continue reading

A Guide To Merging (Based in Git)

In the previous post, I gave a working definition of branching (based on Git’s model of source control) and provided a conceptual model that I hope makes it easier to understand what’s happening whenever you branch code from the master branch of the application.

The thing about creating branches is that they’re typically merged back into the main application once a feature has been completed, a bug has been resolved, or something has been patched.

If branching is taking a copy of the code and creating an independent sandbox out of which to work on the program, then merging is the opposite – it’s taking the code from the branch and pushing it back into the main part of the application.

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑