How to set up a local WordPress Vagrant development environment
Setting up a Vagrant box can be painstaking. Here is the process: Install a basic box. SSH into said box. Run a command. If it works, add the command to a provision file. Destroy your box. Run the box again and see if the command works via a provisioning file too. Whether it works, or…
It’s broke: how do I fix it? Debugging your code in WordPress
I had the great honor of speaking at WPNYC this past week. I promised to publish my slides. I also wrote a post about the Tools of the Trade slides.
How to recursively make a directory (folder) with PHP
When I need to generate or save files in a web application it’s important that I keep all the files in an orderly fashion. Sometimes I think that there’s a fine line between impressionistic and messy. – Lady Gaga Here’s the go-to code I use to generate the directory structure. You can find more solution…
How to use JSONP in WordPress Development. The Quick-and-Dirty QuickStart Guide
Edit: Looking for an easier way to do JSONP in WordPress? What IS JSONP and why should I care? There’s been a lot of debate lately about whether to move your site to SLL (https) or not. It’s clear, though, that all your forms, at least the ones that handle sensitive data like logins, should…
How to Convert Docx to HTML
For my current side project I needed to allow a user to upload a docx file and then continue editing it from their WordPress dashboard. I chose docx because it is an open standard based on XML. I figured that might make things somewhat easier. Unzip Docx file Many modern formats these days are compressed…
Handling a PHP unserialize offset error… and why it happens
I discovered recently the importance of proper collation of database tables. I inherited a proprietary CMS to manage. The default collation was latin1_swedish_ci. Apparently it’s because “The bloke who wrote it was co-head of a Swedish company”. The problem occurred when a form we had on our site began getting submissions with foreign characters. The…
How to Write a CSV Directly to PHP://Output I/O Buffer With fputcsv()
Came across this gem half-way down the function page for fputcsv() on php.net Use an associative array for this so your keys will be the csv headers. Enjoy!