Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Dec 1, 2022
1 parent 36b1498 commit baef261
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/block-library/src/navigation-submenu/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,13 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
$inner_blocks_html .= $inner_block->render();
}

$tag_processor = new WP_HTML_Tag_Processor( $inner_blocks_html );
while ( $tag_processor->next_tag( array( 'class_name' => 'wp-block-navigation-item__content' ) ) ) {
$tag_processor->add_class( 'current-menu-ancestor' );
if ( strpos( $inner_blocks_html, 'current-menu-item' ) ) {
$tag_processor = new WP_HTML_Tag_Processor( $html );
while ( $tag_processor->next_tag( array( 'class_name' => 'wp-block-navigation-item__content' ) ) ) {
$tag_processor->add_class( 'current-menu-ancestor' );
}
$html = $tag_processor->get_updated_html();
}
$inner_blocks_html = $tag_processor->get_updated_html();

$html .= sprintf(
'<ul class="wp-block-navigation__submenu-container">%s</ul>',
Expand Down

0 comments on commit baef261

Please sign in to comment.