Tom McFarlin

Software Engineering in Web Development, Backend Services, and More

Page 249 of 429

Using jQuery To Set Select2 Selected Value

As much as I firmly believe in making sure that anything we build for WordPress especially as it relates to the dashboard should remain as consistent as possible.

As with anything, there are a few exceptions that I’ve made in the work specifically when it revolves around large select elements (multiselect or no).  That is, I’m a big fan of Select2 – I’ve written about it a couple of times and how I’ve used it in a couple of projects.

Because this is something that I regularly use, and because I know a number of WordPress developers (and general web developers, as well) also use this in their work – both in the dashboard functionality and in the public-facing functionality, as well – I wanted to share one way in which I’ve needed to programmatically set an option.

Continue reading

Documenting The WordPress Plugin Boilerplate

A little over a month ago, I released the latest version of the WordPress Plugin Boilerplate. The response has been great – more than I was expecting, really but that’s a good thing – and, generally speaking, it’s been overall positive.

The WordPress Plugin Boilerplate Homepage

The WordPress Plugin Boilerplate Homepage

Over the last month or so, it’s become clear that more time and resources will be needed to focus on the Boilerplate and to continue to refine its codebase, its functionality, its documentation, and so on. The bottom line is that I want to make sure that I get the right – or as close to right – as possible during the first try.

To that end, I need some input from others (read: you).

Continue reading

Setting Routines and Boundaries for Self-Employment

About four months ago, I received the following comment on one of my blog posts:

I’d love to hear some thoughts, maybe in a future post, on setting boundaries and establishing routines. My ideal would be to have already been to the gym, at my co working space and starting work by 8:30, finished by 6pm, no exceptions. Despite my best laid plans, I haven’t been to the gym in 2 weeks, I find myself starting work any time between 7am and 11am, and occasionally working late into the night once my son is in bed. Some people dig this freedom, but I find that I crave some structure – I just reject having it imposed on my by an employer.

For some time, I’ve sat on this particular topic because it’s something that I’ve wanted to write about, but either had a backlog of other things I wanted to cover, or it didn’t fit with the type of content I was trying to publish at the given time.

Boundaries of Self Employment

yes – working near your tv is risky business!

But now seems like a good time to look into this: Partially because I’m preparing a few posts that are dealing with a number of tools that I use to get things done, partially because a number of people I know who work from home have shared the same feelings, and partially because this is something that I’ve been doing for the past seven years or so.

But for those of you who want to skip the entire post, here’s the TL;DR:

It depends on your personality type.

Honestly, though, there’s more to it than that.

Continue reading

Minimizing Distractions For Programming

For anyone who’s been programming long enough, I’d venture to say that some of the most productive times of the day come when you’re in the zone.

You know what I mean, too: When you’re minimizing distractions, when you’re listening to whatever music helps you get into the groove, and whatever you’re working on feels almost effortless (not that it doesn’t come with it’s share frustration, but you’re just there and totally focused on the task at hand).

We know this feel.

We know this feel.

At the same time, I think that it’s incredible that we get as much work done as we do. Granted, we all have different ways in which we work, but at any given time I could have the following applications open:

  • Email
  • Twitter
  • Slack (for chat)
  • Google Hangouts
  • Feedly
  • Downcast
  • Notifications from my phone (or tablet)
  • …and so on

And that’s in addition to my IDE. I’m sure the same can be said about you and your environment, too. But here’s the thing: Each of the above contributes to making sure we’re aware as many demands that we have being placed on us, but can you argue that they all make us more productive?
Continue reading

Display an Error if a File Is Too Large for WordPress

If you’re working on a project for WordPress that’s going to allow users to upload files – be it a video, an image, a CSV, or any other type of data – then you’re likely going to be faced with a situation where you’re going to need to determine if a file is too large for WordPress.

Yeah, it's a little too large.

Yeah, it’s a little too large.

What’s considered “too large” can be related to any number of factors:

  • The size of the file is larger than you want to accept (or the file system accepts)
  • A PHP timeout occurs when uploading a file because of its size
  • The file system doesn’t have enough space
  • …and so on.

Whatever the case may be, there are two things that you’re going to need to be able to do:

  1. Determine if the file fits within constraint of the system (whatever the constraint is)
  2. Display an error message to the user before the upload occurs

It doesn’t exactly provide for a stellar experience when trying to upload something only to have it rejected by the server without a proper error message, does it?

Continue reading

« Older posts Newer posts »

© 2026 Tom McFarlin

Theme by Anders NorenUp ↑