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 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:
Code language: PHP (php)
$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"
Like adding a product via the REST API is creating a product variation done relatively quickly – I use the PHP library for that, like in my last week’s post.Continue reading "Creating a WooCommerce product variation with the REST API"
WooCommerce comes with a REST API that, for example, allows us to create products. Here I show you how to do this.Continue reading "Creating a WooCommerce product with PHP via the REST API"
Since WordPress 4.6 it is relatively simple to add validation to customize settings, to give helpful error messages to the user. Here I show you how that works.Continue reading "Validating customize settings with displaying error messages"