emulsion2.1.1での、wp-navigation ブロックの修正は、テスト不足でうまくいきませんでした。理由は、remove_filter( 'render_block', 'gutenberg_render_layout_support_flag' );
を実行したためでした。
emulsion2.1.2では、この失敗をもとにいくつかのフィルターを追加して、問題の解決に取り組みました。
Modified Customizer/Theme Scheme/
Sparate Core Block CSS Load
Fixed Changes cannot be changed properly
add_filter( 'should_load_separate_core_block_assets', '__return_false' )
Renders the layout config to the block wrapper
Fixed Changes cannot be changed properly
remove_filter( 'render_block', 'gutenberg_render_layout_support_flag' ); add_filter( 'render_block', 'emulsion_add_flex_container_classes', 10, 2 );
Added emulsion_add_flex_container_classes() filter
Added Elements styles block support.
remove_filter( 'render_block', 'wp_render_elements_support', 10, 2 ); remove_filter( 'render_block', 'gutenberg_render_elements_support', 10, 2 ); add_filter( 'render_block', 'emulsion_add_link_color_class', 10, 2 );
These features use dynamic classes wp-container-xxxxxxxx, wp-elements-xxxxxxxx to output hard-coded styles. Outside the stylesheet dependencies, it is executed as an inline style in the footer etc., so the level of detail is increased and the theme style is overwritten in the details.
Since wp-container-xxxxxxxx and wp-elements-xxxxxxxx are dynamic classes, they change each time they are displayed, so it is difficult to adjust the style of the theme. (For example, in the case of flex-container, the class related to the position and direction of the content is not output, so it cannot be overwritten with CSS from post author)
For the above reasons, I created it with a filter that just adds a class.
These changes can be reverted to the Gutenberg settings at any time in the customizer.
リンクカラー
THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG
THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG
THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG
THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG
フロントエンドに、位置クラスが追加されない
gutenberg/lib/block-supports/layout.php
wp-container-uniqid()でスタイルがセットされている、uniqid()は、表示するたびに変更されるので、このスタイルをテーマで上書きするのは、困難