Media Categories 1.6 Beta

I am happy to see that so many people have found this plugin useful. I’ve had many feature requests, a couple code contributions, and plenty of bug reports. I appreciate it all. It’s been over a year since there was an update to the Media Categories plugin, so I’ve been hard at work this past week adding a ton of new features. I’ve taken to heart as many feature requests and bug reports as I could handle. ...

April 1, 2014 · 5 min · 1046 words

Git Smarter: Retrieve deleted files from history [ git unremove ]

In the course of development, there are times you want to look at or retrieve a file deleted sometime in the past - and you probably don’t know when it was deleted. I’ve written a simple git alias that makes it super easy. So how does this work? If you don’t care, then just copy and paste the config line above - if you want to know what’s going on here, read on. ...

March 25, 2014 · 2 min · 368 words

VIM: Saving with sudo, without opening with sudo

It happens all the time. You open a file in VIM, you make three and a quarter trillion changes, and then realize you needed sudo but didn’t use it when you opened the file. What do you do? Well, if you might save the file under a new name, then quit, delete the original and rename the new file with the original name. It works, but its really annoying. Luckily there is a cool trick in VIM that lets you save with sudo, even after having opened a file without it. Here it is. ...

August 20, 2013 · 2 min · 262 words

Wooden 3D Printed WordPress Logos #wcchi

It’s day 3 of WordCamp Chicago 2013. On day 1, the Foundation Friday, my hobby of 3D Printing came up in conversation and someone suggested that I print a WordPress logo. On day 2 I brought two 3D Printed logos, printed with Cherry Laywoo-d3, a material used for 3D printing made from repurposed sawdust mixed with a plolymer (pro tip: saying polymer in an meaningful context make you sound smart!). ...

June 30, 2013 · 1 min · 174 words

WP_Query: Get Posts by Relative Date

Someone asked me today how to use WP_Query to get posts by a relative date. The codex provides an example on how to achieve this. Heres what is shown on the codex. I feel that its sloppy and not very flexible. Having to add the filter and remove it each time you want to do this is ugly. I solved this some time ago and had to dig through some old code to find it. ...

April 11, 2013 · 1 min · 140 words

Better Git: Interact With a Branch, Without Checking it Out.

Tricks for interacting with a branch, without checking it out. Browse a directory (like ls): Syntax: 1 2 git show [ref]:[path] git show master:your/path/ See contents of a file (command as above): Syntax: 1 2 git show [ref]:[filepath] git show master:your/path/file.php Checkout a specific file or directory from a different branch: Syntax: 1 2 git checkout [ref] -- [path] git checkout master -- your/path/file.php Note: There are other ways to do similar tasks such as git ls-tree and they may have more options. However I find these to be more accessible and easy to remember.

April 10, 2013 · 1 min · 95 words

Better Git: git fetch not getting tags

I just ran into a little gotcha with regard how fetch handles tags. When it pulls down commits, you will usually see that it also pulls down tags. I was a little confused today when fetch was refusing to pull a tag that was clearly in the repository (git ls-remote --tags) lets you see tags available on the remote). I kept running the fetch command but the tag wouldn’t get pulled down. The reason has to do with the way fetch works, it only fetches tags that are direct references to a commit that is in a branch being fetched. To get all tags regardless of what commits they reference use the fetch in the following way. ...

February 21, 2013 · 2 min · 223 words

Better Git: How to find out what submodules there are in a different branch

Generally speaking Git is fantastic and easy to use - one of the few pain points is where submodules butt heads with branches. Far from solving all the problems in related to this - I’ve found an easy way to find out what submodules are in a branch, commit, or tag without having to check that reference out. This method also shows you the commits that each submodule is currently pointing to. ...

February 5, 2013 · 1 min · 211 words

Blending Custom Post Types and Custom Taxonomies

In the past I’ve mentioned a very complex plugin named “WidgetPress”, which I built and is the underlying foundation of the Sears Community and Kmart Community sites. What WidgetPress does is complex, and the short time I had did not allow me to really clean it up the way I would have liked to. This is why I have not released it publicly. However, the lessons learned from WidgetPress are many, and some of the ideas and solutions that led to its completion can be feathered out of the bulky plugin into their own stand-alone plugins. Thats exactly what I am trying to do now. The specific functionality I’m working on right now is the idea of using custom post types and taxonomies in such a way that they are no longer independent. It will take some explaining to show how this is useful so I will start by explaining how it is used in WidgetPress. ...

January 28, 2013 · 3 min · 637 words

Incorrect Datetime Bug Fix Updated - Version 1.1 Released

A user of the Incorrect Datetime Bug Fix plugin submitted a bug report last week. While the plugin was turned on the user was getting an error about improper usage of wpdb::prepare() in WordPress 3.5. 1 Warning: Missing argument 2 for wpdb::prepare() This threw me for a loop, since its such a simple plugin that I’ve never had to change, I assumed that something changed in the new version of WordPress 3.5. I was all ready to submit a new trac ticket. As it turns out, it was my usage of wpdb::prepare() that had always been incorrect, if you are a developer and are interested in knowing more about the problem, read Andrew Nacin’s article on the subject. In the past WordPress simply wasn’t throwing out an error and that’s what was changed in WordPress 3.5. I found this by using git’s bisect feature, which is really great and I might write a blog post about it in the future. ...

January 7, 2013 · 2 min · 216 words