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:
https://gist.github.com/FreshLondon/9f95ce73867df7a001c12583cbbfe414
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!
Here's our mixins file:
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:
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.
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: