A quick and dirty logger for Gravity Forms

Today I noticed pieces of code to hook into a logger scattered throughout Gravity Forms, when I was trying to track down an issue. Here’s some quick and dirty code which hooks into the logging methods and writes to the PHP error log: Continue reading A quick and dirty logger for Gravity Forms

Clickable stack traces with Netbeans

I’m clearly in a fickle mood this month, as I’ve changed my PHP editor again, this time to Netbeans (thanks to the tireless nagging of @JJJ)… so far, so good. I particularly love being able to jump to declarations quickly and easily.

One hurdle I overcame today, and I’d be interested to know if there’s a more Netbeans-y way of doing this, is getting my beloved Xdebug clickable stack traces (see my previous post to get these working with Textmate and Sublime Text). Continue reading Clickable stack traces with Netbeans

Clickable stack traces with PHP Xdebug and Sublime Text (other editors/IDEs are available)

Have a look at this. Ugly, isn’t it? But so so useful.

Continue reading Clickable stack traces with PHP Xdebug and Sublime Text (other editors/IDEs are available)

Laying out a grid in WordPress

For a recent project, I needed to lay items out in a series of grids, sometimes three columns, sometimes more. The CSS provided by the designer looked something like this:

.columns section {
float: left;
margin-left: 20px;
width: 220px;
}
.columns section.one {
clear: left;
margin-left: 0;
}

I could have used jQuery, or some of the more advanced CSS selectors, to achieve this, but here’s what I created as a custom WordPress template tag. Continue reading Laying out a grid in WordPress

Installing ImageMagick on MacPorts and imagick on PECL

Over the last few hours I’ve installed ImageMagick on MacPorts (super easy), and imagick on PECL (not so much). Xentek‘s post on ImageMagick and imagick was a great help, and got me past the first brick wall I hit (passing in the ImageMagick prefix to prevent it complaining about Wand-config)… but then I couldn’t get the darned extension installed. Anyway, here’s the steps I went through, and if anyone has any suggestions for improvements I’m all ears. Continue reading Installing ImageMagick on MacPorts and imagick on PECL

PHP error logs with MacPorts on OSX

I’ve recently had to switch laptops while my main machine is in for repair (again), and this has reminded me of an issue I seem to encounter with MacPorts PHP. I make extensive use of the PHP function error_log during development, to track variables and ensure that things within the code are as I expect.

Maybe it’s me, but MacPorts PHP seems to have an issue writing to an error log unless you do some quick configuration. So, as this blog is meant to function partly as my outboard brain, here’s what I had to do. (Some of this gleaned from patient advice given by Ryan, the MacPorts PHP maintainer, on a misguided bug report I filed.) Continue reading PHP error logs with MacPorts on OSX

Interspersing your post listing with date headers in WordPress

Update: OK, so at least one person wanted it as a plugin, so feel free to download Intermittent Date Headers.

Here’s a code snippet that’s not really worth making into a plugin. It’s designed to put date headers into your main post listing page. As an example, you could end up with:

Heading: March, 2008
Post: dated 15th March
Post: dated 28th March
Post: dated 29th March
Heading: April, 2008
Post: dated 1st April
Post: dated 4th April

Continue reading Interspersing your post listing with date headers in WordPress

I’ve made a useless WordPress plugin…

…which you might find useful if you develop plugins with system requirements, like a particular version of PHP. This plugin is a simple proof of concept for a method of messaging the user when they activate a plugin.

Continue reading I’ve made a useless WordPress plugin…

Exclude Pages now hides child pages where appropriate

Exclude Pages (my WordPress plugin which allows you to remove pages from site navigation) now handles child pages more gracefully. Previously, when you excluded a page any child page would drop down a level, taking it’s place… not what I wanted, and not something I’d noticed because I was only dealing with single level navigation when I wrote the plugin. Continue reading Exclude Pages now hides child pages where appropriate