Is it possible to create column width presets in Gutenberg?

Just in case anyone else comes looking here’s what I did. First I enqueued a javascript file into the block editor. add_action( ‘enqueue_block_editor_assets’, function () { wp_enqueue_style( ‘block-editor-styles’, get_template_directory_uri(‘styles/gutenberg.css’), false, ‘1.0’, ‘all’ ); wp_enqueue_script( ‘block-editor-scripts’, get_template_directory_uri(‘scripts/gutenberg.js’), array( ‘wp-blocks’, ‘wp-dom’ ), time(), true ); }); Then I just used this bit of code for adding a … Read more

Get blocks from other pages, from within current page

WordPress provides a way to get an array of blocks for a page with the parse_blocks() function. If you extract from that the specific block(s) you are interested in, you can then use render_block() to put the block on another page. This function would do that: function example_extract_block_type_from_page( $post_id, $block_name ) { //get post_content for … Read more

Custom Gutenberg block is not showing up in inserter dialog

You should enqueue your scripts using enqueue_block_assets action, like this: add_action(‘enqueue_block_assets’, ‘gutenberg_bolierplate_block’); Second, you should use JSX with modern JavaScript development environment to write your blocks easily. I made a boilerplate for my personal use that you can use: https://github.com/HardeepAsrani/gutenberg-boilerplate You just need to run npm install to install dependencies, and then npm run dev … Read more

How to remove specific panels in the editor (Gutenberg) when editing a block (via right panel)?

Removing specific panels or features for a block is done on a per block basis using various hooks (https://github.com/WordPress/gutenberg/issues/15450#issuecomment-635255936) Update (August 2021) Removing specific panels (that would allow for customization of a block) can now be done through the theme.json aka global settings and styles which allows you to customize settings (colors, typography, etc) for … Read more

Best practices for CPT without using an editor [closed]

I have used the custom block option quite extensively. I enable the editor for the custom post type, but use a custom template with template_lock set to true: ‘template’ => array( array(‘pb/custom-block-name’), ), ‘template_lock’ => true Then I use the allowed_block_types_all filter to only allow that custom block for the post type: function pb_allowed_block_types($allowed_block_types, $block_editor_context) … Read more

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş