Possible add color palette for a block’s inner div instead of outer?
Possible add color palette for a block’s inner div instead of outer?
Possible add color palette for a block’s inner div instead of outer?
Using the component outside the editor. select(‘core’) is null
Can I customize any WordPress parent block-based theme template files by child theme like a parent classic theme?
You don’t need the nightly build unless you’re looking for deeper core compatibility issues. For strict Gutenberg compatibility, the plugin itself should be sufficient as long as you keep it updated. You can do the nightlies on a fresh install if you wish, but it’s unnecessary overkill IMO. I would (and do) unit testing with … Read more
So I found a solution. There are 4 hooks that can be used to accomplish this depending on the exact needs. The hooks are from wp-includes/meta.php in functions update_metadata() and add_metadata(). Hooks: update_postmeta updated_postmeta add_post_meta added_post_meta These are called at different states and from the names it is pretty self self explanatory. add_post_meta and update_postmeta … Read more
Editor styles work much differently in the block editor. This is because the content in the previous editor was loaded in an iframe, so you could use a stylesheet isolated from the rest of the admin, and do things like use the body selector to change the font in the editor. The content in block … Read more
In 5.0 new function was introduced (docs): WP_Screen::is_block_editor( bool $set = null ) which sets or returns whether the block editor is loading on the current screen. So you can do that check using this code: global $current_screen; $current_screen = get_current_screen(); if ( method_exists($current_screen, ‘is_block_editor’) && $current_screen->is_block_editor() ) { // DO SOMETHING } You can also add to this … Read more
You can make use of components inside your block. However, to insert a block inside your block you need to make use of the editor component Innerblocks. Using it you can set a predefined template which includes certain blocks in a specific order. Or you can set allowed blocks that can be added by the … Read more
You need to use Custom Post Type for blocks. What it does is you can register your own post template with predefined blocks in it. Which I believe is what you are looking for. Here’s example of that – function myplugin_register_book_post_type() { $args = array( ‘public’ => true, ‘label’ => ‘Books’, ‘show_in_rest’ => true, ‘template’ … Read more
You should use a custom page for this. For reference, we can modify the default (twentynineteen) post content block. Depending on your theme, you may need to modify single.php, or a content block included from there. In the twentynineteen theme, we can see this on line 24: get_template_part( ‘template-parts/content/content’, ‘single’ ); Following that, we can … Read more