Categories
Blog

How to reinstall WordPress via WP-CLI

You can easily reinstall WordPress on an existing site using WP-CLI with this command: It’s important to note the two parameters: [–skip-content]: Download WP without the default themes and plugins.[–force]: Overwrites existing files, if present. We want this in order to overwrite any corrupted or infected files. Read more: wp core download – WP-CLI

Categories
Blog

Compress and extract tar.gz files

A very simple reference for compressing/extracting tar.gz files, which I always forget how to do.

Categories
Blog

px → rem

px → rem quick reference

Categories
Blog Tips

How to extract attributes from an HTML string in PHP (without using RegEx)

Say you have an <a>, <link> or other HTML element and you need to extract its href (or other) attribute. You can extract those values using DOMDocument quite easily: Link to Repl.it PHP: DOMDocument

Categories
Apps/Tools Blog

Spoticalc – Spotify bandwidth calculator

Recently, we were wondering with a couple of friends how much data Spotify was sucking out of our cell phone data plans. I knew that with a 3GB/mo. plan I could get away with most of my needs, but there was also streaming quality into the mix.

Categories
Blog

How to convert JPGs to WebP automatically

The easiest way to convert a ton of JPGs to WebP is to use the cwebp command line utility written by the WebP team. Here’s how I do it using a very simple Bash script: This goes through all JPG files in ./source/uploads folder, converts them with a 90% quality rate and writes the output […]

Categories
Blog

How to convert SVG files to PNG automatically

A few weeks after the designer handed off about 500 tidy little icons, some customer requested PNG versions for all those. Of course one option would be to export all again in PNG format. While possible, I wanted to simplify the designer’s job after creating new icons: hand off the SVGs and we’ll take care […]

Categories
Blog Tips

How to remove captions from Instagram embeds in WordPress

This is a simple code snippet to achieve just that in Instagram embeds, via shortcode or using Gutenberg. [instagram url=https://www.instagram.com/p/B1WjYcxCmHp/ hidecaption=true] You can achieve the same effect in single embeds by using the following shortcode Here’s the result YouTube Use this snippet if you want to achieve a similar result wit YouTube embeds: Has this […]

Categories
Blog

Updating Laravel Homestead

(!) Notice: this post is probably outdated Recently I needed to update my Homestead VM to a more recent version, because I needed to run PHP 7.2. While you can just update PHP on a current Homestead instance, I was using a very old Homestead version and wanted to update it. Moreover, I wanted to […]

Categories
Blog

Enjoyable WordPress theming with Timber (and ACF)

I was thinking of doing an in-depth tutorial on Timber. A few days since I started a draft, CSS-Tricks published “Timber and Twig Reignited My Love for WordPress“, which is a great read. However, I decided to push some of it live because this plugin deserves more love. I’ve built a lot of WordPress sites. Recently, it has become […]