Your site doesn’t include support for the block… after registering a block

The js-file is not executed on time By the time the DOM load event is executed the block editor has already parsed the post content and at that time the block wasn’t yet registered so it tells you that it doesn’t exist. Instead of: window.addEventListener( ‘load’, () => { mcm_register_menu_card_section_block(); }); try: wp.domReady(mcm_register_menu_card_section_block); and in … Read more

Wrapping Gutenberg Blocks with a div/section/article

Use ‘Groups’: If you do not see the ‘Group’ option, like me, you’ll have to update WP. After that, simply create a group, then add new blocks or drag existing blocks into it. Select the group and add HTML Anchors and classes via the ‘Advanced’ tab of the block’s menu.

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)