As a freelance developer I have multiple projects on my laptop, along with site backups, older versions, etc. If this stuff disappears it could mean weeks to months of lost time and will lead me to curling into the fetal position in a corner and crying over and over again.

I currently have four backups, yes four, and three different methods for each:

  • Time Machine backing up to a NAS with two mirrored disks.
  • Carbon Copy Cloner backup up to the same NAS.
  • Time Machine backup up to a WD MyBook.
  • Backblaze cloud backup.

As far as I can tell, none are 100% reliable, and thus enter my frustrated post.

For the past couple of days TM has been telling me it cannot backup to the MyBook and to check it with Disk Utility. Now, you see, I did this about two months ago so I know what it means. It means that somehow the TM file is corrupt and it’s going to format the drive and start again. I run Disk Utility anyway, and sure enough, the drive is now being formatted.

One backup down.

Since this happened, I started thinking, what happened to Carbon Copy Cloner, I haven’t heard from that app in awhile. So I check, I find it’s been running daily, and it’s been failing daily for the past three months. Thanks for the notification.

I decided to manually run CCC, it starts, then fails and says the destination drive is full. I guess it must be backing up more that 300gb, because that’s how much is free. Again, thanks for nothing.

Two backups down.

Back to TM and the NAS. This thing fails about every two months like clockwork. I’ve Googled this one, search numerous Mac/OSX/Apple forums about it and it just seems to be that TM has issues with backing up over wifi and will eventually fail. I actually just started a new backup about 3 weeks ago on this one. *two thumbs up*

Three backups down.

Backblaze. It seems to work, but because it’s a cloud service, it only goes back 30 days for deleted files and revisions. I have this for worst case scenario reasons like fire, theft, rabid raccoons, etc. My problem with this one isn’t the 30 day thing, it’s that I can make changes to or add files, tell it to backup and it immediately will tell me that it’s up to date without backing up files. Maybe I’m being picky, but I think it should backup things if I tell it to, not when it decides to find them.

Fourth backup not down, but I’m disappointed in you.

Now to finish wasting my time making sure that my backups are all working.

Recently I came across an amazing plugin named Advanced Custom Fields. This thing allows me to rapidly develop themes with clean, easy to use forms for custom fields. Those custom fields become the main content of front end layouts, much like my current About page.

This plugin has the ability to have a JSON file that has your field structure in it, and if you update that file, it will ask you if you want to sync those changes. Well, since I am going to hide the plugin, and I want to just push updates to my clients, I needed a way to automatically sync the updates.

I opened up the code for the plugin to see how the sync worked, took some of the code, and wrote my own function to perform the sync. Enter the gist of it:
Jump to post “Automatically update Advanced Custom Fields field groups via JSON”

I am currently working on a project where the designer has created 5 top level items in the primary nav of site. These items are meant to look like buttons and have fixed widths, so there will be a problem if the end user of the theme then decides they want 6 top level elements and they retain that fixed width. I needed a way to add a class to the nav defining how many parent/top level items there are, and then I could style the nav based on that.

Here’s what I’ve come up with:
Jump to post “Add a parent count class to WordPress nav menu containers”

So, I keep expanding my bag of tricks for WordPress, and one of the tricks I have is a media uploader that be placed in a meta box or in widget settings by just adding a couple lines of HTML, jQuery does the rest from there. The problem I ran into was when a new widget was added the click events were not bound to them, which is because the html for the widget is dynamically added, but you already knew that.

I dug into the WordPress jQuery code (/wp-admin/js/widgets.js to be exact) and found this:

This will allow you target the newly created widget with a function you’ve created:

Congrats, you have one less white hair today.

Let me preface this, this is only if you are creating a widget and not if you just want to add a class to an existing widget, there are plugins that do that.

It’s really actually simple, I just could not find the answer right away because it isn’t one of those things mentioned in the Widgets API section of the WordPress Codex.

The above link has this in the Example when creating a widget:

If there were one more line (like the below), then this post wouldn’t exist. The array that holds the description can also have a key of classname, which can have a string value, which is turned into your widget’s css classes.

Happy coding.