Pretty PHP dumps using highlight_string()

This is a nice little trick if you’re sick of the almost impossible to read var_dump. function dump($data) { highlight_string(“<?php\n” . var_export($data, true) . “\n”); } <?php dump([‘foo’ => ‘bar’, ‘baz’ => ‘foobar’, ‘status’ => true]); ?> And it should come out something like this. Nice, eh?

Add cache busting to styles and scripts

Have you ever made changes to a website and the client told you he or she can’t see the updated version? I bet you have. The best cache busting is to append a random string to the filename. assets/main_d808a276.css Most starter themes comes with this by default, and it’s awesome! But if you’re working on … Continued

Obfuscate email addresses

Some of my clients really don’t want to put their email addresses in clear text out in the public. After all, the internet is not very forgiving. For me and my private projects, I’ve never taken this into consideration and I’ve never had any issues with bots finding and spamming me. But it sure exists, … Continued

Performance tips when using WP_Query

The WP_Query class is very powerful and can be used in many ways. Here is a quick tip to enhance the performance. Read the inline comments! $args = [ ‘posts_per_page’ => 500, // Don’t use -1. Instead, set a high number if you need to get a lot of posts. ‘cache_results’ => false, // Just … Continued

Speed up your website by optimizing images

The biggest bloat on the web is images. Most website’s consist of more than 60% images and it’s a big problem. Our users demand faster and faster websites and lowering the image size one easy, fast and cheap way to please them. Although this is absolutely a good way lower the size of your images. … Continued

Getting better control of Gravity Forms

Gravity Forms is without doubt one of the best form plugins out there. I chose this to be my go-to form creator for a few reasons. The pricing is very clear, unlimited installs, you get access to loads of Add Ons and everything is well documented. It’s is incredibly powerful with it’s drag and drop interface, … Continued

Fetch media from production to local environment

Why download images and other heavy resources to your local computer, when you have them available to the public? This does not only save space on your local hard drive. It saves a lot of time syncing resources from production to your local environment. This snippet first checks if the resource is present in your … Continued

Reduce server load using Expires Headers

Expires Headers tells your browser if the requested file should be fetched from the server or from the browsers cache memory. The point of Expires Headers is to reduce the files the user has to download and create a faster experience. The second reason is to reduce the servers load. Expires Headers also tells how … Continued