Categories
CMS Mastering Development Wordpress

Multiple Select on Gutenberg Sidebar as metakey

I want to show a multiple select element in the sidebar when editing a page in admin, where I can save the selected values in a metakey. Of course also load the selected values upon load of page-edit in admin. I manage to show the list, but I don’t know how to save it i […]

Categories
CMS Mastering Development Wordpress

JSX in WordPress Plugin Development

plugin.php <?php /** * Plugin Name: Test * Version: 1.0.0 */ defined( ‘ABSPATH’ ) || exit; function test__register_block() { if ( ! function_exists( ‘register_block_type’ ) ) { // Gutenberg is not active. return; } wp_register_script( ‘test’, plugins_url( ‘block.js’, __FILE__ ), array( ‘wp-blocks’, ‘wp-i18n’, ‘wp-element’, ‘wp-editor’ ), filemtime( plugin_dir_path( __FILE__ ) . ‘block.js’ ) ); register_block_type( […]

Categories
CMS Mastering Development Wordpress

How should you internationalize javascript spread in multiple files but build in one?

I have followed the instructions for internationalization on: https://developer.wordpress.org/block-editor/developers/internationalization/, but it doesn’t seem to play well with the development tools for Gutenberg. It will find all the translations in the src directory in the multiple js files, however make-json will generate multiple json files. The only way it seems to work is to edit the […]

Categories
CMS Mastering Development Wordpress

Gutenberg block JavaScript localisation on Polyglots does not work

I can successfully translate my plugin using wordpress.org for all php strings. Everything is fine. I can even see the strings that needs translation on https://translate.wordpress.org/projects/wp-plugins/simpletoc/stable/de/default/ In this case it is “Update table of contents”: https://plugins.trac.wordpress.org/browser/simpletoc/tags/1.8/build/index.js#L111 So I translated them and waited 24 hours. I could translate new php strings but still the JavaScript translations […]

Categories
CMS Mastering Development Wordpress

Gutenberg block JavaScript localisation on Polyglots does not work

I can successfully translate my plugin using wordpress.org for all php strings. Everything is fine. I can even see the strings that needs translation on https://translate.wordpress.org/projects/wp-plugins/simpletoc/stable/de/default/ In this case it is “Update table of contents”: https://plugins.trac.wordpress.org/browser/simpletoc/tags/1.8/build/index.js#L111 So I translated them and waited 24 hours. I could translate new php strings but still the JavaScript translations […]

Categories
CMS Mastering Development Wordpress

What is the correct way to import the blocks-editor?

I was following a blocks tutorial that was using @wordpress/editor to import some components and everything was working correctly but I was getting tons of deprecation warnings in the browser all saying I should be using @wordpress/block-editor instead. So I replaced it and installed the block editor in npm: npm install @wordpress/block-editor –save then in […]

Categories
CMS Mastering Development Wordpress

Gutenberg Block Style CSS Class Is Not Applying on Backend

Block HTML on the front end are getting the “is-style-option1” class added but for some reason the backend block HTML is getting the “is-style option1” class being added. Here are the block style on index.js – styles: [ { name: “default”, label: __(“default”), isDefault: true, }, { name: “option2”, label: __(“Layout 2”) }, { name: […]

Categories
CMS Mastering Development Wordpress

Gutenberg Block Style CSS Class Is Not Applying on Backend

Block HTML on the front end are getting the “is-style-option1” class added but for some reason the backend block HTML is getting the “is-style option1” class being added. Here are the block style on index.js – styles: [ { name: “default”, label: __(“default”), isDefault: true, }, { name: “option2”, label: __(“Layout 2”) }, { name: […]

Categories
CMS Development Wordpress

Using Gutenberg block components in admin interface controls

I asked a previous question, and got a helpful answer that got me going quite a ways. The present problem is unrelated, but IMO reflects the dearth of documentation suitable for those of us who aren’t familiar with some of the nuances of javascript, are completely new to Gutenberg development, and yet need to tweak […]

Categories
CMS Development Wordpress

Using Gutenberg block components in admin interface controls

I asked a previous question, and got a helpful answer that got me going quite a ways. The present problem is unrelated, but IMO reflects the dearth of documentation suitable for those of us who aren’t familiar with some of the nuances of javascript, are completely new to Gutenberg development, and yet need to tweak […]