Skip to content

Commit

Permalink
Add menu-item-home class to Navigation for front page
Browse files Browse the repository at this point in the history
Closes #29423
  • Loading branch information
George Hotelling committed Dec 10, 2021
1 parent d3b1327 commit 16797bc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/block-library/src/page-list/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ function block_core_page_list_render_nested_page_list( $open_submenus_on_click,
}
}

$front_page_id = (int) get_option( 'page_on_front' );
if ( (int) $page['page_id'] === $front_page_id ) {
$css_class .= ' menu-item-home';
}

$title = wp_kses( $page['title'], wp_kses_allowed_html( 'post' ) );

$markup .= '<li class="wp-block-pages-list__item' . $css_class . '"' . $style_attribute . '>';
Expand Down

0 comments on commit 16797bc

Please sign in to comment.