Software Engineering in WordPress, PHP, and Backend Development

Author: Tom (Page 259 of 428)

How to Check if a WordPress Posts Exists by Its ID

I was recently having a conversation with a friend and fellow WordPress developer about the best ways to go about checking if a post exists given nothing but an ID.

For those who are experienced with the WordPress API, there are a number of ways to go about doing this. Functions and classes that exists for things like this are:

  • `get_post`
  • `WP_Query`
  • Running a direct query with `$wpdb`
  • …and so on

Each of these has its advantages and disadvantages, but of everything listed above, there are always two things I try to make sure that I do when working with simple functions (like checking on the existence of a post).

I try to make sure the function:

  1. Is as lightweight as possible
  2. Is as easy as possible to read within the context of the existing code

After all, months from now, you never know if you’ll recall why you wrote code a certain way nor will your team or your peers necessarily know why the code you selected is set in a certain way.

Continue reading

The Negative Effects of Changing WordPress Theme Design

For as much as I’m a fan of approaching WordPress theme and plugin development as one would any other type of software project, there’s one thing about releasing major updates to themes that I don’t think should be treated as some people treat software projects.

That is, when it comes time to do a major release of a theme – regardless of what the version number is (because that’s a discussion for an entirely different post) – I think that the presentation layer or the way the theme looks or its general styles shouldn’t deviate very much from the initial design.

Think about a number of the major applications that you use on a day-to-day basis. This can be desktop software, this can be mobile applications, this can be an operating system, this can be web applications, and this can even be other WordPress themes.

A tubular update to the UI of a dog collar.

A tubular update to the UI of a dog collar.

Then, think about how often their interface changes. When it comes to major updates, there’s often times a major change in the interface or the introduction of a different way of doing something within the application. The change can be significant.

Although this introduces a learning curve which often leads to frustration on the user’s behalf, and although this is something that’s normal because of the advances in technology, I don’t think it necessarily applies to the look and feel of WordPress themes.

Continue reading

A Plugin to Remove WordPress Pingbacks

As I mentioned in yesterday’s post, I’m going to be turning off pingbacks for the public-facing side of this blog for a number of reasons the least of which is not to help make it easier for others to participate in comments.

In order to do that, I’ve written a small plugin that helps makes this really easy to do:

  1. Download the plugin
  2. Install and activate it
  3. And you’ll be good to go

Sound simple, right? Here’s more information.

Continue reading

Turning Off WordPress Pingbacks

One of the features of WordPress that used to be significantly more popular is that of trackbacks and pings (or more commonly referred to as pingbacks). In short, it’s a way for those who run a blog to know when someone else has linked to one of their articles.

It’s kind of a flattering thing, isn’t it? I mean, someone is writing a post and then linking their content to yours? Then again, sometimes they could just be responding to something you’ve said in a negative way. That’s not always the most flattering thing, I guess, but it fosters conversation nonetheless.

Pingbacks are the ping pong of blogging. Or something like thing.

Pingbacks are the ping pong of blogging. Or something like thing.

Regardless, I’ve seen some people question the purpose of pingbacks, question whether or not they should be enabled or disabled, and question whether or not they actually help readers when skimming through the content.

Though I personally don’t have any kind of evidence from any kind of study to back up any of those points above, I have decided to turn pingbacks off on the public-facing aspect of my site in the coming days.

Continue reading

An Image Widget for WordPress

One of the best parts about being someone who uses WordPress on a daily basis both for personal use and in doing work for others is the ability to create solutions to problems that you encounter throughout your day-to-day.

Obviously, some problems are more complex than others and require more elaborate solutions, whereas others are easier problems that still may call for a simpler solution, but a solution nonetheless.

Case in point: In a few recent projects, I’ve needed to integrate an image widget that allows users to easily upload images into sidebars and/or widgetized areas of their blog. The challenge, however, is that there are multiple ways to go about doing this.

So my first take at implementing a solution for this particular problem comes in the form of the Pressware Image Widget for WordPress.

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑