Gutenberg curation in WordPress
Last active
December 14, 2025 15:16
-
-
Save proweb/6f3ca2f27b0ba0afae5b8d28b3217003 to your computer and use it in GitHub Desktop.
Guenberg blocks for WordPress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $block_types = WP_Block_Type_Registry::get_instance()->get_all_registered(); | |
Работа с паттернами
Скопировать код паттерна из Gutenberg
Экранировать JSON через https://www.jsonescaper.com/
Открыть Playground базовый Blueprint
вставить в ENV['content']
Получить список цветов в консоли.
wp.data.select('core/block-editor').getSettings().colors;
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment