Function: metres to feet and inches

We had a project recently where ACF fields for metres needed to be converted to feet and inches, a useful PHP snippet was tasked with the job of converting these measurements. It worked out great!

Here's the function:

Sass (SCSS) media query mixins

Breakpoints are essential when creating compatible sites for the array of modern day handsets and devices.
Usually this is done with media queries but they take quite some time to write out, a recent search resulted in a great media queries mixin which I'm now using across all of my current SCSS projects.
Team this with a bunch of handy IDE shortcuts and you're quickly writing media queries with ease.

All thanks for the creation of these magical mixins go to Glenn McComb for his hard work and ingenious solution!


The magical mixins:

Here's our mixins file:

The shortcut snippets:

I'm also using pre-defined shortcuts to easily produce these snippets for each breakpoint within my IDE.

This is different for each IDE, I've edited mine for PHPStorm and it looks something like below:

Lambda expression

This is saved from an answer by Staplerfahrer on stackoverflow. As this library of snippets is mostly for my own personal reference I'm stealing it and including it here for later use!

I don't like function_exists('fun_name') because it relies on the function name being turned into a string, plus, you have to name it twice. Could easily break with refactoring.

Declare your function as a lambda expression:

$generate_salt = function()

And use thusly:

$salt = $generate_salt();

Then, at re-execution of said PHP code, the function simply overwrites the previous declaration.

Strip posts from WordPress search queries with a true/false ACF meta value

Display a list of additional thumbnail sizes set within a WordPress theme

Working on a theme you may want to know which image sizes are available, aside from the default WordPress 'thumbnail' sizes.

Alternatively, display ALL available image sizes in WordPress:

© 2021 - FreshLondon