How to add arbitrary custom CSS to a WordPress Block Theme using Site Editor?

In WordPress 6.1.1 (released 2022-11) this is not possible in the UI. But good news: In WordPress 6.2 (to be released somewhen March 2023) this will be possible! Was introduced as an experimental feature in Gutenberg 14.8 from 2022-12 (see video ) It works like this: WordPress Dashboard > Appearance > Editor Open the Styles … Read more

Full site editing templates folder vs block-templates

After some more checking, I found the issue. The repo I was setting up, was a template that will be used by other sites, so I saved it in a folder called templates (Full path: /Users/bas/git/work/templates/wp). In the wp-includes/block-template-utils.php the name/slug of the template is decided with the following code. $template_slug = substr( $template_file, // … Read more

In Full Site Editing, how do I get the templates I created to appear in the site editor when populating a new page?

When creating a page template in Appearance > Editor you can add a Post Content block. This is where the page content goes. Everything else is part of the template and applies to all Pages that use the template. When you go to Pages > All Pages and select a page to edit, or use … Read more

Get postId in a wordpress pattern file?

In block themes patterns won’t have access to context such as id it seems: https://developer.wordpress.org/block-editor/reference-guides/block-api/block-patterns One has to create a custom block to get post id and use useSelect hook to get post Id like so: import { useSelect } from “@wordpress/data”; … inside Edit block function: const postId = useSelect(select => select(‘core/editor’).getCurrentPostId()); then, postId … Read more