Software Engineering in WordPress, PHP, and Backend Development

Tag: WordPress (Page 208 of 219)

Articles, tips, and resources for WordPress-based development.

Going Above and Beyond The WordPress Coding Standards

Recently, fellow tweep @Krogsgard asked about some of the things that I do to go above and beyond the basic set of WordPress Coding Standards.

To be clear, I think that the Coding Standards are the foundation on which you need to be building your coding style. They’re the foundation of writing professional-grade code for WordPress, so start with that and build on top of it.

Everything else is just bonus.

So, with that said, here’s what I try to do to go above and beyond the WordPress Coding Standards.

Continue reading

Simple Country, State, and City CSV’s for Download

If you're only interested in the files and without implementation details, then you can grab them.

Every now and then, I end up working on a project that requires a form that includes county, city, and state information. More often than not, the client doesn’t about the rich data associated with any of the above – that is, they’re not particularly interested in latitude, longitude, population, or even zip code.

Simply put, they want the user to be able to select their country, select their city, and then select their state from a predefined list of options.

For the past couple of projects, I’ve been using three, very simple CSV’s for this and thought I’d share them here should anyone else want to use them. Additionally, I thought I’d share a simple implementation of how they can be used in WordPress projects.

Continue reading

What Constitutes Clean Code in WordPress?

When it comes to writing code specifically for WordPress, I try my best to follow a combination of the WordPress coding standards, tips and advice from various books I’ve read (which I hope to cover in a future post), tips from others in the community, and certain habits that I’ve developed along way the way.

The thing that I’ve always struggled with determining is what constitutes clean code. There is code that follows standards, then there’s clean code, and I think that the definition is almost somewhat subjective.

With the open source nature of WordPress, the desire to improve education around the platform, the desire to improve the plugins repository, and the existence of things such as Theme Review team, Theme Unit Test, and tools specifically for helping us write code, there’s an innate desire for programmers to write clean code – I just think that we could do a better job defining it.

To be clear, I don’t believe that clean code is synonymous with quality code, nor do I believe that clean code is synonymous with good code. They’re absolutely all related, but they aren’t the same thing.

With said, what does constitute clean code specifically in the context of WordPress development?

Continue reading

Programmatically Resize Images in WordPress

If you're experienced with programmatically uploading files, you may wish to skip down to the code.

I’m finishing up an application that’s built on WordPress that has required that I programmatically resize images. When it comes to building themes or plugins, it’s relatively easy to specify add_image_size and then let the user interface and core application do it’s thing.

But in my case, the end user will have no idea that the actual application is built on WordPress and the image resizing function needed to be a little more tailored for specific templates (or views)

So rather than use the typical WordPress facilities for uploading and resizing images, here’s how to programmatically resize images in WordPress.

Continue reading

How To Use WP_User_Query For WordPress User Queries

Earlier this week, I published a post on how to find users in WordPress by using meta data. In short, I have a collection of users each of which have unique meta data and I needed to locate a user based on said meta data.

In the comments, Curtis of @WPThemeTut recommended I check out WP_User_Query as opposed to way that I was doing it (which I’ll cover momentarily).

Because the WordPress API has a tendency to introduce new functions for querying specific data in later releases, and because I try to be a proponent of using the newer methods, I wanted to cover WP_User_Query in a bit more detail.

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑