Debug This – WordPress Plugin

I’m excited to release my latest plugin. It’s a great tool for developers to debug their plugins or themes. Debug This comes with 49 different debug modes to help expose specific raw data when you need it. The benefit of Debug This is the time saved from hardcoding var_dump or print_r to see WP globals, queried objects, etc… Developers can easily add new debug modes from their theme or plugin.

Debug This utilizes the WordPress Admin bar for mode navigation. All mode navigation links are relative to whatever page/post you are viewing. Custom modes and be nested in grouped drop-downs.

I really like the Debug Bar plugin and I’ve created several extensions for my personal use. However, there are times when I want to see the raw data in a full-screen width. Once you click a Debug This mode, it takes you to an immersive full-width experience.

Finally, DT renders the page first before displaying the debug mode. Custom debug extensions can analyze the rendered page with the supplied buffer in their callback function. This allows for intricate debugging that no other plugin offers (that I know of).

Update: If Debug This doesn’t suit your needs, I came across another great debug plugin called Debug Objects.

Debug This

WordPress Plugin79KDownloadsDownload Now »

Audit Post Attachments

One of the more annoying things about WordPress is the inability to see how many files are attached to a post without invoking the media upload area. Here’s a plugin I whipped up to report posts and their attachments by post type. Enjoy!

WordPress Remove Attachment Rows Where File Doesn’t Exist

Here’s a nifty script I cooked up tonight. This basically looks through all of your attachments and see if the associated real files exist on the server. If they don’t, the attachment database row is deleted. I realize this isn’t the most useful tool for everyday use. It was built for a one-off use case and I didn’t want this script to get dusty in my local files. So, here it is for your consumption or truncation!

Sublime Text WordPress Snippets and Auto-completions

I have become a huge fan of Sublime Text 2 as of late. It’s a simple, yet behemoth-featured editor that allows you to craft your own unique editing experiences. This post is not touting all the wonderful features about Sublime, but if you’re not using it you should be. It’s available for Mac, Windows and Linux.

I primarily develop websites based on WordPress, and I find myself frequenting the Codex on a daily basis to look up parameters that I haven’t memorized. Over time this can amount to a lot of time wasted. Fortunately for me and you, there is a Sublime WordPress package ready for you to install in mere seconds. This gives us a lot of WordPress goodness at our fingertips right in the editor.

To install through Package Manager, type CMD-SHFT-P (Macs) and ‘Type Package Control: Install Package’. Wait for the package search dialogue to appear then type ‘WordPress’ and hit enter. Boom. Done.

To take advantage of all the new WordPress goodness, simply type a WP-specific function and hit tab to auto-complete. Repeatedly hitting tab will move through the function parameters. There is also snippet goodness as well. You can take a look at all of the snippets and auto-completions here.

For instance if you would like to insert a plugin header, make sure you are in PHP syntax mode and type ‘plugin_head’ and then hit tab. In the CSS syntax mode, you can type ‘theme_head’ and move through all of the definitions with the tab key.

This is not even the tip of the tip of the tip of the iceberg with Sublime. Here’s a great course on what Sublime can do for you and your workflow.

If you would like to install the WordPress Sublime package manually, go to: https://github.com/purplefish32/sublime-text-2-wordpress and clone the repo to your package library.

FileMerge Fail – Changes App Awesome

So, I’ve been using the de facto FileMerge religiously for the past couple of years. With the latest OS iteration, FileMerge has failed miserably using 10.8.1. Basically, FileMerge would not allow you to save a file after an hour of intricate merging. This is an equation for higher blood pressure. Apparently OS 10.8.2 fixes this issue now, but it was not available during my period of serious frustration, so I began to look elsewhere.

I tried the Kaleidoscope app, but was disappointed as it only compares files, but has no merge capabilities. Albeit, a beautiful application, but useless to me nonetheless without merging. It’s price is $39.00 which is pretty steep for just comparing files.

After a bit of searching, I stumbled upon the Changes app. It’s certainly not as fancy as the previously mentioned app, but it does everything I need it to do. The feature I’ve found most useful is the “Copy To Left” and “Copy To Right” feature. This does inline merging. That means no waiting for post processing an entire file, your changes are saved instantaneously.

It’s a bit of an investment at $40.00 USD ($1 more than Kaleidoscope – spend the extra dollar), but it’s well worth the time and frustration saved. There are many other features that I don’t even use that might be useful to you as well.

Arrrrrrr, clean up your whitespace matey

I get thoroughly annoyed at code files littered with EOL and BOL tabs and spaces. Here’s a simple regex I use to garbage collect rogue whitespace. Just use find/replace and set your search to regex within your IDE. Replace with null.

[ \t]+$