It is possible to disable the publish/update button in Gutenberg. With that, we could, for example, force the user to add data to a custom block that adds metadata to a custom post type.Continue reading Conditionally prevent publishing/updating in Gutenberg
The document sidebar of the block editor contains various panels, for example, one for the featured image and, for posts, one for tags. If specific panels are not used, it could be useful to hide them, to make the sidebar clearer. This post shows you how to do this.Read more
WordPress’ block editor comes with the feature of block templates. This allows us to defined a set of blocks that will be present in the content of new pages, posts and/or custom post types. This post shows you how to use that functionality and how to use reusable blocks in templates.Continue reading Define block templates for new pages, posts, and custom post types
Sometimes there is a block for the WordPress block editor that is almost what we want, but it would be necessary to modify the markup it saves to the database. This post shows how we can filter the save function of a block to get that done.Continue reading Modify save function of block
Yesterday I had the problem, that the core table block is not wrapped in a
div at the frontend. Of course, it is great that no useless markup is outputted, but I needed a wrapper element for my responsive table solution. Here I show you how to wrap a core block in an element.
In this post I show how to create different color palettes in Gutenberg, to – for example – allow other colors for the text than for the background.Continue reading Create different color palettes with Gutenberg
If a PHP script runs, the page loads typically as long as the script needs to finish (or throws an error). That is fine for many cases, but if the script needs to process complex and/or many tasks, that take a few minutes or even hours, it would be nice to put that tasks in the background. This post shows you how to create background processes in WordPress with a library.Continue reading Creating background processes in WordPress
If a WordPress installation is protected via
.htaccess basic auth, the requests against the WooCommerce REST API with the PHP library do not work. I did not find the GitHub issue where someone said that CURL could be used to set the login credentials, but with that information, I found a question and the answers on Stack Overflow, that helped me:
$ch = curl_init(); curl_setopt( $ch, CURLOPT_USERPWD, 'user:password' );
I inserted these two lines at the beginning of my script and replaced
password with the actual login data. With that, the requests against the protected installation worked.
Two of my recent articles are about the WooCommerce REST API and the official PHP library from Automattic, which makes the usage of the API with PHP easier. This post describes a way to run multiple requests against a shop at the same time.Continue reading Parallel requests against the WooCommerce API with the PHP Requests library
WordPress 5 will come with a new editor called »Gutenberg«, which is completely different from the current TinyMCE. That does not only mean change for the users, but also for theme developers, who want to modify editor styles, so it looks like in the frontend. This post shows you how that works for the new editor.Continue reading Creating theme editor styles for Gutenberg