Skip to content

Category: Development

Clear Floats in WordPress

Clear Floats in WordPress

Editing WordPress pages, I often float images left or right so that text flows nicely around them. Sometimes, though, I—or my less tech-savvy clients—want the next paragraph to start below the floated image, also if that image happens to be ‘too tall’. (Note: I was hoping Gutenberg would somehow turn this into a non-issue, but alas.) A CSS-only solution is possible, but will clear every paragraph within a post: .entry-content p:after { content: ""; display: table; c… Read more →

Conditionally Disable a WooCommerce Payment Method

Conditionally Disable a WooCommerce Payment Method

A client recently asked me to create a custom payment gateway for WooCommerce Subscriptions, but disable it for regular products. While I had left out ‘products’ from the WC_Payment_Gateway supports property, the payment method would still show up on checkout, even if the shopping cart contained nothing but regular products. I thus had to actively remove it from the available payment methods. Thanks to the woocommerce_available_payment_gateways filter hook, though, doing so is easy e… Read more →

Valet for Windows

While I’d previously used Valet for Linux (a Linux port—duh—of the popular web development environment), I did not know about Valet for Windows until recently. (Valet, for those not in the know, makes it très easy to run several development sites at the same time, at distinct local domains.) To install Valet on Windows, I simply followed the README file’s instructions, with two notable exceptions: I manually installed PHP 7.2 in C:\php I did not ‘manually configure… Read more →

Composer (and Laravel) on Shared Hosting

Composer (and Laravel) on Shared Hosting

Got shared hosting with SSH access? Let’s get Composer up and running, the same way we did with WP-CLI. Getting Composer to Work Download the latest composer.phar en upload it to your host’s home directory. Or, better still, download it straight from the command line: cd curl -O https://getcomposer.org/composer.phar Make the file executable: chmod +x composer.phar Define a composer alias in .bashrc: alias composer="~/composer.phar" Reload .bashrc: source .bashrc Et voilà! Installing… Read more →

WP-CLI on Shared Hosting

Did you know you’re able to install the WordPress command line interface on your shared host—provided you’ve got SSH access? Even if you can’t move wp-cli.phar to your /usr/local/bin/ as per the official installation instructions, you can still set up an alias for the wp command in .bashrc. Installing WP-CLI Start off—as per the manual—by simply downloading WP-CLI. cd curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar Verifying… Read more →