Skip to content

Commit

Permalink
Remove variables that were only used once
Browse files Browse the repository at this point in the history
  • Loading branch information
carolinan committed Jun 28, 2023
1 parent f876b35 commit 5a54899
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions packages/block-library/src/home-link/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,10 @@ function block_core_home_link_build_li_wrapper_attributes( $context ) {
);
$style_attribute = ( $colors['inline_styles'] . $font_sizes['inline_styles'] );
$classes[] = 'wp-block-navigation-item';
// The ID of the static page assigned to the blog posts index (posts page). String, '0' if not set.
$page_for_posts = get_option( 'page_for_posts' );
// The ID of the current page.
$page_id = get_queried_object_id();

if ( is_front_page() ) {
$classes[] = 'current-menu-item';
} elseif ( is_home() && ( (int) $page_for_posts !== $page_id ) ) {
} elseif ( is_home() && ( (int) get_option( 'page_for_posts' ) !== get_queried_object_id() ) ) {
// Edge case where the Reading settings has a posts page set but not a static homepage.
$classes[] = 'current-menu-item';
}
Expand Down Expand Up @@ -136,14 +132,10 @@ function render_block_core_home_link( $attributes, $content, $block ) {
return '';
}
$aria_current = '';
// The ID of the static page assigned to the blog posts index (posts page). String, '0' if not set.
$page_for_posts = get_option( 'page_for_posts' );
// The ID of the current page.
$page_id = get_queried_object_id();

if ( is_front_page() ) {
$aria_current = ' aria-current="page"';
} elseif ( is_home() && ( (int) $page_for_posts !== $page_id ) ) {
} elseif ( is_home() && ( (int) get_option( 'page_for_posts' ) !== get_queried_object_id() ) ) {
// Edge case where the Reading settings has a posts page set but not a static homepage.
$aria_current = ' aria-current="page"';
}
Expand Down

0 comments on commit 5a54899

Please sign in to comment.