diff --git a/mu-plugins/blocks/notice/index.php b/mu-plugins/blocks/notice/index.php index cb17817b..5181b8fc 100644 --- a/mu-plugins/blocks/notice/index.php +++ b/mu-plugins/blocks/notice/index.php @@ -49,6 +49,10 @@ function render_callout_as_notice( $attr, $content, $tag ) { // Sanitize message content. $content = wp_kses_post( $content ); + // Temporarily disable o2 processing while formatting content. + add_filter( 'o2_process_the_content', '__return_false', 1 ); + $content = apply_filters( 'the_content', $content ); + remove_filter( 'o2_process_the_content', '__return_false', 1 ); // Create a unique placeholder for the content. // Directly processing `$content` with `do_blocks` can lead to buggy layouts on make.wp.org. diff --git a/mu-plugins/blocks/notice/postcss/style.pcss b/mu-plugins/blocks/notice/postcss/style.pcss index 77bc89f6..75bbf025 100644 --- a/mu-plugins/blocks/notice/postcss/style.pcss +++ b/mu-plugins/blocks/notice/postcss/style.pcss @@ -27,6 +27,10 @@ align-self: start; } + & p:empty { + display: none; + } + & p:first-child { margin-block-start: 0; } @@ -35,6 +39,14 @@ margin-block-end: 0; } + /* o2 adds a data script tag to the notice content on some Make blogs. + * In this case we need to remove bottom margin from the second to last element instead. + */ + + &:has(.o2-data) :nth-last-child(2) { + margin-block-end: 0; + } + & br:first-child { display: none; }