Software Engineering in WordPress, PHP, and Backend Development

Category: Notes (Page 24 of 49)

Notes on programming-related problems that I’ve encountered while working on various projects.

Adding More Fields to the WordPress Media Uploader

Last week, I shared a short post on how to include your own instance of the WordPress Media Uploader in your theme or your plugin.

Though it walks you through everything that you need, on aspect of using the instance that I described is that it’s limited. This is fine for certain situations, but there are other times where you may want to grab more information from the user.

Case in point, the post received the following comment:

Now, how do you activate (turn on) the Insert Image via URL feature of the Media Uploader?

Which I thought was a good question especially given that most of us are used to seeing more options in the media uploader than what the previous post described.

Continue reading

Tagging Untagged Posts in WordPress

This weekend, I shared how to setup a query to find all untagged posts in WordPress that aren’t tagged with a specific tag. In my example, I opted to use IDs (for no particular reason), but Ross also showed how you can use slugs, as well.

Anyway, there are a number of things that you can do with untagged posts – perhaps you want to remove them, perhaps you want to categorize them, or perhaps you want to apply a tag to them so that they’re stamped with a tag (like one that was not

Continue reading

Find Untagged Posts in WordPress

It’s common for people to categorize or tag their posts when using WordPress. This is true for the average blogger and for those who are using WordPress for its content management features.

For example, let’s say that you’re responsible for working on a site that has an RSVP custom post type and the post types can be tagged for certain types of events.

Tags may include:

  • Formal
  • Informal
  • Wedding
  • Birthday
  • Family
  • Friends
  • …and so on

Overtime, the database is going to increase in size and if RSVPs aren’t manually entered (that is, they are imported or maybe the database is even inherited and mismanaged), there’s a chance that some of the posts will not be tagged.

If you’re a developer, the odds are strong that you’re going to need to at least locate the untagged posts (and perhaps update them, as well).
Continue reading

Your Own Instance of the WordPress Media Uploader

One of the nicest features of WordPress 3.5 was the introduction of a refresh of the WordPress Media Uploader.

For developers who aren’t familiar with the change, the short of it is a new version of the media uploader was built using Backbone.js and Underscore.js both of which are newer JavaScript libraries that introduce a different type of structure to creating JavaScript-intense web applications.

Sometimes, one of the challenges that comes with working with any new feature is the lack of documentation around how to take advantage of it. When that happens, you’re more or less left to dig into the core source code and/or the documentation for each of the specific libraries to learn how to use them.

Continue reading

Writing JavaScript Helpers for the WordPress Theme Customizer

I’ve talked before about how I think the addition of the WordPress Theme Customizer (well, soon to be called the Customizer) is one of the nicest additions to the core application in a long time. I’ve also talked about how I fear the direction that some developers will take it.

Regardless, if you’ve worked with the Customizer long enough – especially when it comes to the JavaScript aspect of it – then you’ve likely noticed that you can end up writing relatively repetitive code especially when you’re working with something such as a list of items or something similar.

When you end up reaching this particular point, having too much of the same code with the only variations being a few strings ends up being a bit of a code smell.

In order to prevent this, it’s often better to write helper functions that abstracts the repetitive functionality into a single, ahem, function that you can call with the strings that are unique to your use case.

Here’s what I mean.

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑