222 days and counting 🎉

Categories: Development

For 222 consecutive days, I created at least one commit on GitHub every day. Initially, I planned to do one commit for at least 100 days. Now, that I already doubled that number, I’m aiming for 365 days while dreaming about 1000 days.

170 days and counting

Categories: Development, Education

Initially, I planned to do one commit a day for at least 100 consecutive days. Well, that was 170 days ago and I’m still creating at least one commit a day. As you can see on the chart above, recently I haven’t built much “skyscrapers”, thus, it’s about time to create another section of high-rising towers. 😁

100-day GitHub streak

Categories: Development

Exactly 100 days ago I planned to do one contribution to GitHub for at least 100 days. While it was not always easy to create a contribution due to travelling, I’m glad I made it! I just accomplished my 100-day GitHub streak!

Move .git to the parent directory

Categories: Development

During development, we follow a specific file and folder structure. It’s common that things change during development. And in some cases, it’s necessary to move .git to the parent directory. This post shows how to achieve that.

Fix Jetpack related posts in WordPress 5.3

Categories: Development

Earlier today, WordPress 5.3 got release. Unfortunately, this seems to have affected Jetpacks related posts. Instead of centred, the related posts were suddenly left aligned. I went ahead and added the following code to my site, which not only centred the related posts but also made that container wider. This is the CSS code I’ve added to my site:

View this gist on GitHub

BeforeAfter

Exclude node_modules and vendor from theme check plugin

Categories: Development, Theme, WordPress.org

While I created countless themes, I’m currently creating my first theme for the WordPress.org theme repo. To ensure a smooth reviewing process, I’m using the plugin Theme Check as mentioned in the theme review handbook.

After adding both composer and npm to my theme, I ended up with an Fatal error: Allowed memory size of 536870912 bytes exhausted error. Investigating this issue brought me to:

https://github.com/WordPress/theme-check/issues/4https://github.com/WordPress/theme-check/pull/9https://github.com/WordPress/theme-check/issues/103

I found the solution to my specific issue in:

https://github.com/WordPress/theme-check/pull/9/commits/64402b1586bee4a87a0afdf7dfee913958068168

Thus, I went ahead, opened the main.php in the root folder of the plugin and replaced

View this gist on GitHub

with

View this gist on GitHub

While this might not be the best solution to solve this issue, it allows me to analyse my theme.

Adjust GROUP_CONCAT() maximum length

Categories: Development

I’m currently working on a redesign of a site of a good friend. He’s a professional photographer from Amsterdam and I built his first site in 2011. Back then, I build his site with nexCMS, my very own CMS, which was based on the Zend Framework. Throughout the years, my friend created almost 4000+ posts and uploaded 13.000+ images.

Optimize images using using WP-CLI

Categories: Development

While working on my sister’s site, I noticed that every image was available in 10 different formats caused by 19 different images size definitions.

I do have to say that my sister is a professional photographer who keeps blogging regularly since 2012. Throughout the years she uploaded 6000+ images. Due to the various images sizes the upload folder of her site used 10 GB storage.

To save storage, I’ve analyzed which of the defined images sizes are actually used and which one can be replaced and removed. In the first step, I set the height and width of the obsolete images to zero pixels by adding the following snippet to my functions.php:

View this gist on GitHub

In the next step, I deleted the obsolete images sizes one by one using the following WP-CLI calls:

View this gist on GitHub

While I could have skipped this step, I wanted to work on one image size at a time to be able to measure the impact of the change. After the first round of optimization the images sizes looked like this:

After checking the site to verify that no images are missing I then removed all obsolete image definitions by replacing the previous snippet with the following one:

View this gist on GitHub

After the second round of optimization the images sizes looked like this:

In a final step, I regenerated all images by running the following WP-CLI statement:

View this gist on GitHub

While it’s not much, I was able to save 300 MB of space on the server. I assume that while I’ve deleted many images, I might have also created a few variations of images that haven’t existed yet. This is the final result.