How to add a class to Tag Cloud items – WordPress

If you want to extend the WordPress Tag Cloud Widget with your own custom CSS class, you can easily use the wp_generate_tag_cloud_data filter like so: Docs: filter: wp_generate_tag_cloud_data wp_generate_tag_cloud()

How to add PurgeCSS to Hugo

One of the best optimizations you can add to your static site generated with Hugo is purging unused CSS. Today we’ll be using the veteran PurgeCSS with the out of the box PostCSS support from Hugo. Did you know Tailwind CSS uses PurgeCSS as well? From 80kb to 10kb For my Hugo project I reduced […]

How to add custom meta data to WordPress REST API

The WordPress REST API is a very neat thing. I’m using it to pull my To-Do list into my Firefox Start Page, which I find totally awesome 🤩 If you’re using custom post meta data is not as straight forward. For some reason the meta data is not exposed by default when you query posts […]

How to create a Firefox custom Start Page

Overengineering. This is my takeaway after learning how to add a local addon to Firefox in order to have a custom start page on each new tab. A while back I came across this subreddit called StartPages where users post their custom browser start pages. I thought it was very cool and wanted to try […]

How To Shuffle An Array in JavaScript

Fisher-Yates Algorithm Most of the answers on StackOverflow on how to shuffle an array are not truly random. I wanted to repost this, so we never lose it. Using this algorithm from 1938 we can shuffle an array with more true randomness than other options out there. JavaScript implementation Here’s the JavaScript version of the […]

Creating a To Do list WordPress theme

You might not know this about me but I used to be a WordPress developer, I used to get paid to exclusively develop Themes and Plugins at the company I worked for. It has been a while and I’ve lost the edge when it comes best practices and latest news. Specially around PHP and MySQL. […]

How to export Chrome CSS code coverage

Google Chrome allows you to export the code coverage as JSON but not as the file. At least not that I could find how to do it. It was easier, however, to find how to generate a new CSS file based on the JSON export. Use this small PHP script to output the used CSS […]

Get elements by XPath – JavaScript

I was trying to do a querySelector by text, trying to find elements with certain text content of an element. It turns out you can do that with XPath without much effort. With any XPath expression you can think of. Query the elements In my particular use caes, the HTML looks like this: Use your […]

How to create gradient text in CSS

I wanted to add a css text gradient to some parts of my site. It’s well supported in modern browsers. Found this awesome pen and had to import it into my site 😍 How does it look? mix-blend-mode Part of the magic here is this CSS property (MDN Docs), which is well supported: Then combine […]

How to sort by multiple fields in GraphQL

Wasn’t quick to find the official documentation for this, so here it is in case you’re wondering. Single field sorting Multiple field sorting You can define an array of values for both order an fields. My full working query for printing a list of TV Shows ordered by season and then by the episode number.