Gutenberg curation in WordPress
Получить список цветов в консоли.
wp.data.select('core/block-editor').getSettings().colors;
Gutenberg curation in WordPress
Получить список цветов в консоли.
wp.data.select('core/block-editor').getSettings().colors;
| <?php | |
| // Allow only needed blocks in post types | |
| function wpdocs_allowed_post_type_blocks( $allowed_block_types, $editor_context ) { | |
| if ( 'sponsors' === $editor_context->post->post_type ) { | |
| return array( | |
| 'core/paragraph', | |
| ); | |
| } | |
| if ( 'news' === $editor_context->post->post_type ) { | |
| return array( | |
| 'core/paragraph', | |
| 'core/list', | |
| 'core/image', | |
| 'core/buttons', | |
| 'core/quote', | |
| ); | |
| } | |
| if ( 'faqs' === $editor_context->post->post_type ) { | |
| return array( | |
| 'core/paragraph', | |
| 'core/list', | |
| 'core/image', | |
| 'core/buttons', | |
| ); | |
| } | |
| return $allowed_block_types; | |
| } | |
| add_filter( 'allowed_block_types_all', 'wpdocs_allowed_post_type_blocks', 10, 2 ); |
| <?php | |
| $block_types = WP_Block_Type_Registry::get_instance()->get_all_registered(); | |