Save JSON data with Gutenberg and show it in the content
Save JSON data with Gutenberg and show it in the content
Save JSON data with Gutenberg and show it in the content
The problem is that you’re using setIsOpen() incorrectly. Your code initialises isOpen as false, and your code implies that it can be either true or false, but that’s not what you’re setting it as. The setIsOpen() function updates isOpen to the value you pass to it, and you’re passing an object with an isOpen property, … Read more
Embedded block editor in block editor
You can use wp_localize_script() to pass JavaScript variables to the editor: $asset_file = include(get_template_directory() . ‘/path/to/blocks/index.asset.php’); wp_register_script( ‘pb-theme-blocks’, get_template_directory_uri() . ‘/path/to/blocks/index.js’, $asset_file[‘dependencies’], $asset_file[‘version’] ); wp_localize_script( ‘pb-theme-blocks’, ‘pbThemeBlocksVars’, array( ‘classes’ => array(), // Your theme classes go here ) ); Then in your edit function: const classes = pbThemeBlocksVars.classes;
Yes, “why you can’t insert a reusable block inside your custom block when you’ve used alllowedBlocks?” This is what I am trying to get This is because you haven’t allowed them: allowedBlocks={[‘example/children’]} The list of allowed blocks does not include reusable blocks ( core/block ), so they are not allowed and cannot be inserted. Add … Read more
WordPress is inlining the style as an optimisation: When a page gets rendered, stylesheets that have opted-in to get inlined get added to an array. Their size is retrieved using a filesize call (which is why the path data is necessary), and the array is then ordered by ascending size (smaller to larger stylesheet). We … Read more
This really depends on your theme. Somewhere in its template files the title is generated, including the anchors. This differs per theme, but you’ll have to look for something like this: echo ‘<a href=”‘. get_permalink . ‘”>’ . get_the_title . ‘</a>’; If it is hard coded like this, you’ll have to choice but to override … Read more
Will WordPress updates remove Gutenberg Additional Classes?
Gutenberg: How to constrict floated table blocks to 1000px width in the front-end, when align wide & full are being used?
How to set a template part area?