From 2505367de0ae2d2bbb807f09766a601ac5cff847 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Wed, 4 Jan 2023 20:53:44 +0000 Subject: [PATCH] use dynamic label on front of site --- packages/block-library/src/navigation-link/index.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/block-library/src/navigation-link/index.php b/packages/block-library/src/navigation-link/index.php index d306f0e568a93c..d1d999aea3abf0 100644 --- a/packages/block-library/src/navigation-link/index.php +++ b/packages/block-library/src/navigation-link/index.php @@ -159,7 +159,8 @@ function render_block_core_navigation_link( $attributes, $content, $block ) { $has_submenu = count( $block->inner_blocks ) > 0; $is_active = ! empty( $attributes['id'] ) && ( get_queried_object_id() === (int) $attributes['id'] ); - $theUrl = $post ? get_permalink( $post ) : $attributes['url']; + $dynamic_url = $post ? get_permalink( $post ) : $attributes['url']; + $dynamic_label = $post ? $post->post_title : $attributes['label']; $wrapper_attributes = get_block_wrapper_attributes( array( @@ -172,8 +173,8 @@ function render_block_core_navigation_link( $attributes, $content, $block ) { ''; - if ( isset( $attributes['label'] ) ) { - $html .= wp_kses_post( $attributes['label'] ); + if ( isset( $dynamic_label ) ) { + $html .= wp_kses_post( $dynamic_label ); } $html .= '';