Category: Web Development

  • Database Indices

    I recently had the pleasure of indexing our company’s sites’ tables. The custom CMS I inherited has some really brilliant code, but it also has quite a large amount of idiotic code blocks as well. In this case, the database was not thought out as best it could have. I was able to reduce some…

  • Demystifying the WordPress Plugin

    I asked one of the guys on my team to build a WordPress plugin, he balked. I realized that he just didn’t get how easy it is. So I thought I’d dedicate some time to dispelling the myth that plugins are complicated to write. “Plugin” sounds formidable. But really, a plugin is a file in…

  • 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 Use a post-receive Git hook to mark a deployment in NewRelic

    I recently started monitoring my systems with NewRelic. Fantastic tool. One fun feature they provide is that you can mark in NewRelic’s dashboard when you’ve deployed new code. This way you can compare your site performance before and after the deploy. Using Git’s post-receive hook is perfect for this, especially since I already use it…

  • Code Is Poetry

    At the bottom of every page of wordpress.org is the above statement, and it’s not just an empty phrase. I learned what I know from digging into WordPress. It started by my breaking the site I was supposed to be managing, sorry Karin. Many books, themes, plugins and years later I seem to be able…

  • 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!

  • How to Use AJAX in WordPress Development. The Quick-and-Dirty QuickStart Guide

    Edit: Enjoyed this? Check out my new post on AJAX using JSONP in WordPress. There are some great posts and a fantastic wiki page explaining how to use AJAX in WordPress. But I haven’t found a quick plug-and-play tutorial. So here goes… The problem: A simple form that will give the visitor an input and…

  • WordPress postmeta is useful, but be careful

    The add_post_meta(), delete_post_meta(), update_post_meta(), and get_post_meta() functions are really useful. It’s the perfect place to store information about a post. Many plugins take advantage of this storage for determining whether a specific post/page needs the feature they are providing or not. Example: I recently installed on a site I manage the WordPress HTTPS plugin; it…