Tom McFarlin

Software Engineering in WordPress, PHP, and Backend Development

Page 251 of 428

A Dilemma of the WordPress Customizer

In the past, I’ve talked quite a bit about the WordPress Customizer. I think it’s one of the best features for both developers, designers, and users because of how quickly it shows the user the result of changes s/he is making to their site by changing a few options.

On top of that, the Customizer has two ways in which the preview pane can load the content:

  1. Ajax
  2. Refresh

That is to say that once the user changes an option, the entire preview pane can be refreshed (or reloaded), or the changes can be performed via Ajax and the page never refreshes.

Generally speaking, I think Ajax is preferable to performing a refresh, but I’ve recently found myself working on a project where I’ve had to mix the two, and I’m not really liking it. Chalk it up to a personality quirk, but I have this “all or nothing” mentality when it comes to how the preview pane displays its changes.

Either all of the options should work via Ajax, or all of the options should trigger a refresh but mixing the two feels off.

Continue reading

Programmatically Add Multiple Post Terms in WordPress

A couple of weeks ago, I shared a simple gist for how to programmatically add post terms in WordPress. If you’ve read the series on importing CSV files into WordPress, then you’re likely to encounter something like the following scenario:

Given a CSV, apply multiple terms to a single post when the terms are delimited by another character.

So, for example, let’s say that you have a CSV and each value is, naturally, separated by a comma. Within one of the columns, words – or terms, in our case – are delimited by semicolons. Each value that precedes a semicolon represents a term (related to any given taxonomy in the system – this is irrelevant for this particular post).

Adding multiple terms to a post, or post type, is relatively simple and can be based off the functionality already shared.

Continue reading

WordPress and Small Team Source Control

Whenever I’m in the process of working on something for a client, my usual setup is something like this:

  • Work on the code on my local machine’s development environment
  • Keep the code in source control using GitHub
  • Use Dploy.io to deploy the latest commit to a staging server
  • Repeat until ready to launch

Straightforward enough, right?

But there have been a couple of times when I’m working with designers or front-end developers who need to work on, say, CSS files while I continue to do some of the backend work.

If they’re comfortable working with source control, then granting them access to the repository of the project and having them commit their changes to be part of the deployment process works fine.

But what about the case where the frontend developer is going to be working on various styles that you won’t personally be touching, and they aren’t using source control during the development phase of the project?

Continue reading

Easier Dev Practices For Everyone

Comments are closed on this post. Rather than posting a comment, submit a few dev practices.

I don’t talk about this much on this particular blog because it’s outside the scope of the usual content on which I try to focus, but whenever there’s something worth mentioning, I bring it up.

As such, almost a year ago, I started Dev Practices. In fact, I have a very short post introducing the site on September 16th, 2013.

I still stand by what I said in the first post:

There are two absolutely amazing things that the Internet has brought us:

1. Animated GIFs

2. Memes

And when you combine the two together, you get some seriously good stuff, right?

When I set out to create the site, I didn’t really think of it as anything else that a dumb way to have some fun for a little while.

But it grew into a just a little bit more than that.

In fact, I’ve even considered porting it to WordPress and adding a lot of new features around it. Maybe eventually, but the honest truth is that it’s just a fun site, and there are so many other things that have priority.

So I’ve tried to compromise and improve just one part of the process. For now.
Continue reading

Importing CSV Files into WordPress: Clean Up

This is the final part in a series for how to Import CSV Files into WordPress.

Over the past few posts, I’ve walked through a strategy that I’ve found to useful and effective when importing large CSV files into WordPress.

Specifically, I’ve broken the approach down into three other articles each of which covers a high-level overview of how to achieve a certain part of the process through a mix of PHP, JavaScript, and pseudo-code.

Up to this point, I’ve covered:

  1. How to setup the script to prevent timeouts
  2. Working to build a back end that supports visual cues on the front end
  3. How to display visual cues on the front use via Ajax

And the last part is by far the easiest: Clean up after yourself.

Continue reading

« Older posts Newer posts »

© 2026 Tom McFarlin

Theme by Anders NorenUp ↑