How to change text size of Gutenberg editor

If you came here, like me, looking for how to adjust the available text size options within Gutenberg, you can add this code to your theme’s functions.php file (you can add as many options as you like): add_theme_support( ‘editor-font-sizes’, array( array( ‘name’ => __( ‘Normal’, ‘your-theme-text-domain’ ), ‘shortName’ => __( ‘N’, ‘your-theme-text-domain’ ), ‘size’ => … Read more

Add metabox to document tab in gutenberg

Here is the solution. Hope it will help you const { registerPlugin } = wp.plugins; const { PluginDocumentSettingPanel } = wp.editPost; const MyDocumentSettingTest = () => ( &ltPluginDocumentSettingPanel className=”my-document-setting-plugin” title=”My Panel”&gt &ltp>My Document Setting Panel&lt/p> &lt/PluginDocumentSettingPanel> ); registerPlugin( ‘document-setting-test’, { render: MyDocumentSettingTest } ); https://github.com/WordPress/gutenberg/blob/master/packages/edit-post/src/components/sidebar/plugin-document-setting-panel/index.js#L86

Allow excerpt for pages in Gutenberg?

It’s nothing new with the block editor, it’s the same age-old way by putting the following code into your theme’s functions.php: add_action( ‘init’, ‘wpse325327_add_excerpts_to_pages’ ); function wpse325327_add_excerpts_to_pages() { add_post_type_support( ‘page’, ‘excerpt’ ); } Here’s my screenshot in a fresh WordPress 5.0.3 install:

How to make a script load after Custom Block is loaded in the editor?

I couldn’t find a built in ACF way of doing this. Instead, in my block’s PHP render function I added printf( “<script>window.jQuery(window).trigger(‘acf/loaded/block-name’);</script>” ); This uses jQuery as an event bus to trigger an event when the block is rendered. You might need to include a check that you’re in the admin so the event won’t … Read more

Edit srcset and sizes attributes in Gutenberg image, cover and gallery – blocks

Try the suggestion below: This assumes the <figure> element holding an image has a data-display-alignment attribute to match the alignment class applied attached that is somehow surfaced as a parameter in the wp_calculate_image_sizes hook: /** * Add custom image sizes attribute to enhance responsive image functionality * for content images. * * @param string $sizes … Read more

What is the advantage of ‘register_block_type’ (the PHP function) when creating custom blocks?

1.: The register_block_type lets you load additional stylesheets and scripts for your block in the frontend 2.: As you yourself wrote, register_block_type lets you define a dynamic php render_callback function 3.: If you use a render_callback, you can of course use filters within it. EDIT: As the comments pointed out, there is some clarification needed … Read more