Since WordPress 5.9, there is the new function
Continue reading wp_enqueue_block_style equivalent for scripts
While adjusting color values in PHP, I searched for a way to transform
Continue reading Transform rgb()/rgba() to hex via PHP
rgba() to its hex code equivalents since I like those more. And since the hex notation in CSS allows defining an alpha channel for this since quite some time, there’s no showstopper to build a solution for this. But since this alpha channel notation is relatively new, I couldn’t find any code snippet in the wild that does what I like to. So I wrote it myself.
Continue reading The default values of get_option and get_theme_mod
get_theme_mod come with a handy second parameter to define a default value if the option/theme mod is not available. However, sometimes the return value of these function is still empty despite having a default value set. We look into it how that’s possible.
Whenever you set a page as posts page, it automatically lists all posts. But how to add custom content above or below this post list?
Continue reading Display custom content on posts page
Using React inside the block editor is pretty straight forward since all requirements are already met. But what if you want to use React on a custom page? In my case, I wanted to use React on a custom settings page. Since I couldn’t find any information of how to achieve that, I looked into it deeper.
Continue reading Use React on a custom WordPress settings page
WordPress comes with a handy auto-download feature for non-installed locale files. But how to implement that in a custom function? Since I needed exactly this (I added an identical select for the locale on another settings page to improve our workflow), I looked for a way to get the exact same behavior.
Continue reading Trigger locale download in WordPress programmatically
Did you know that there is a preview of all block editor UI components available? No? Me neither! Just a link in an issue pointed me to these awesome docs, thus I’d like to share it!
Continue reading Preview of all block editor UI components
manage_options) are allowed to do that.
Starting with version 2.0, Imagify implemented a “smart” compression mode that replaced the previous modes “normal”, “aggressive” and “ultra”. Unfortunately, it doesn’t seem to be that smart at all.
This new compression mode uses AI to determine the best compression mode for the given image. There’s no more option for you to tell Imagify which compression mode to use. The only alternative is the also new compression mode “lossless”, which produces much larger files than any of the other compression modes and had to be selected for every media manually.
Continue reading Disable “smart” compression mode in Imagify
If you want to add a new sidebar control to an existing block, there are filters for that. Or if it’s your own block, you can just use
InspectorControls for that. But if you wand to add global settings, which reflect something for the whole post, you need to do it differently.
Since I couldn’t find a proper solution already described in a blog post or documentation, here’s my own one.
Continue reading Block editor: Add settings to document sidebar