This is the third in a series about writing WP-CLI commands. The previous article explained how to import CSV files into a database table. In this, we describe how to add documentation.
Continue reading Adding a WP-CLI Command to Your Plugin, Part 3
The previous article, I showed how to add a WP-CLI command to your plugin. In this tutorial I define the methods to read the CSV data files from standard input, and dump it to the screen.
Continue reading Adding a WP-CLI Command to Your Plugin, Part 2
I wanted to write some importers for CSV files, but not one that operated from the admin screens. I wanted a command that I could pipe my data into, and populate a table.
“Simple,” I thought, and then realized I needed to parse wp-config.php for the database password. While that’s not hard, it’s really bad form, especially when you can use WP-CLI to run commands within the WordPress environment.
Continue reading Adding a WP-CLI Command to Your Plugin, Part 1
You’re running the WP-CLI and get that message, plus the following error:
Error: One or more database tables are unavailable. The database may need to be repaired.
Continue reading PHP Notice: Undefined index: HTTP_HOST in /home/…/ms-settings.php on line 48
I wrote a series of articles about Django 1.8 that has continued to get traffic. Django is now at 1.10!
In yesterday’s post, I talked about fixing up old PHP code to be safer.
There’s another anti-pattern common in old PHP code, and that’s mixing the display logic with the output logic. While some of this is inevitable, nowadays, the rule is to use a templating system like Twig to separate out even small bits of HTML code from the logic.
WordPress does this on the front end via Underscore templates, but configured to use Handlebars-like syntax.
This is a PHP class that does the same thing with PHP. I wrote it so I could use the same, or similar, templates on both the client and server side.
Continue reading WP’s Backbone-like Templating Language
I needed to learn a little about the events triggered in the Customizer, and came up with a little script that prints events to the console log. This is specific to the Customizer’s event system.
Continue reading Observing the WordPress Customizer (wp.customize) Events