Blog

Tips

Use curl on the command line for some quick information on a URL

One neat trick I use a fair bit is hitting URLs on the command line using curl. The most common use case I have for it is checking redirects but if you start using the command you’ll see there’s actually a fair bit of information handed back to you when you type the following in […]

How to set defer or async attributes on enqueued script tags in WordPress

If you get down to business with performance optimisation, you could find yourself looking at ways to defer your scripts or even load them asynchronously. As far as I’m aware, WordPress’ built-in functions wp_register_script() and wp_enqueue_script() don’t currently take arguments for defining these attributes. But, with WordPress being WordPress, there is usually a way and […]

Working with empty jQuery objects to build dynamic selectors

This is one of those techniques that you don’t really think you need until you find yourself in a situation where you do. This definitely isn’t a hammer and more often than not, you can select what you need in a single selector via jQuery or through the use of the built-in .filter() method but […]

Cache jQuery selectors for more efficient JavaScript

Having worked in collaborative and team contexts, I’ve had my fair share of situations where I’m working in amongst someone else’s code. There are plenty of things I could gab on about but one issue I commonly see is duplicate jQuery selectors. Now, for really small scripts, duplicate selectors won’t cause you much heartache. However, […]

Use closures for basic encapsulation when writing jQuery

If you are writing a lot of jQuery you’ll likely have files with loads of JavaScript functions and variables that may be completely independent and shouldn’t interfere with each other. If you have a lot of this going on (or even if you don’t) you might consider wrapping up related variables & functions using closures […]

Got a project? Let's talk.

From website design & SEO through to custom WordPress plugin development. I transform ideas into dynamic, engaging, and high-performing solutions.
Subscribe to get the latest insights & updates in the world of web and how it impacts your business and website.
© 2024 Phil Kurth  |  All rights reserved.