Software Engineering in WordPress, PHP, and Backend Development

Author: Tom (Page 368 of 427)

Writing Clean, Maintainable Custom WordPress Queries

Recently, I was having a conversation with a fellow developer via email about maintaining a separation of concerns in custom WordPress queries and WordPress templates.

The gist of the conversation boiled down to this:

Is it a good idea to keep custom queries in the template files?

A couple of years ago, I would’ve said yes but as I’ve begun to work on more complex projects, I’ve changed my mind: I’m actually a fan of keeping custom queries in functions.php.

I think that this keeps code more maintainable, cleaner, and easier to read, though I’m not sure if this is the most common practice.

Continue reading

How To Programmatically Create a Category in WordPress

If you're an advanced developer or just want the TL;DR version of this, skip to the code.

The majority of the time that I’m working on a contract project, there’s a need to programmatically create several parts of the website that occur during theme setup. Often times, this includes creating posts, users, and/or setting templates.

Ultimately, the goal is to make the user’s experience as nice as possible: They install the theme and the site, to a degree, has bootstrapped itself.

As with the aforementioned parts of a site, it’s also common to need to create a category, or categories, during theme setup. WordPress provides two ways of doing so, one of which often results in a PHP fatal error.

Here’s how to programmatically create categories in WordPress and do so without generating any errors.

Continue reading

My WordPress Development Toolbox

I update this post as my workflow changes. This post was last updated on January 10, 2014.

Periodically, I’ll get emails or comments asking about the various tools that I use in my workflow. You’ll rarely hear me saying that I think any given developer should be using any given piece of software.

Instead, I think that out of all the tools that we have from which to choose, we’re naturally going to like some rather than others – there’s not always going to be a general consensus. Because of that, I’m more likely to share what I like rather than what I suggest.

Since blogging is just as much for the readers as it is for the author, I thought I’d take some time to share what tools I use on a daily basis. Consider this a comprehensive list of tools in a WordPress Developer Toolbox.

Continue reading

WordPress Donations: Is There Shame in Asking?

In light of yesterday’s post and some of the discussion in both comments and offering support for various WordPress projects, I’m curious as to what you guys consider to be etiquette when it comes to asking for WordPress donations.

As I mentioned yesterday, I personally think that we have a personal obligation to provide a level of support for free software that we released; however, at one point is it socially acceptable to ask for a donation.

On top of that, where do you even draw the line?

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑