Twenty Twenty-One: Keep the closing </span> tag in footer links.

When the `link_after` value is emptied to reset any description markup, make sure not to remove the closing tag within footer links.

Follow-up to [49216].

Props sabernhardt, mukesh27.
Fixes #54209.
Built from https://develop.svn.wordpress.org/trunk@51881


git-svn-id: http://core.svn.wordpress.org/trunk@51474 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-10-02 17:06:00 +00:00
parent b3c6ad3a6b
commit e286586eda
2 changed files with 6 additions and 2 deletions

View File

@ -87,11 +87,15 @@ add_filter( 'walker_nav_menu_start_el', 'twenty_twenty_one_nav_menu_social_icons
* @return stdClass
*/
function twenty_twenty_one_add_menu_description_args( $args, $item, $depth ) {
$args->link_after = '';
if ( '</span>' !== $args->link_after ) {
$args->link_after = '';
}
if ( 0 === $depth && isset( $item->description ) && $item->description ) {
// The extra <span> element is here for styling purposes: Allows the description to not be underlined on hover.
$args->link_after = '<p class="menu-item-description"><span>' . $item->description . '</span></p>';
}
return $args;
}
add_filter( 'nav_menu_item_args', 'twenty_twenty_one_add_menu_description_args', 10, 3 );

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.9-alpha-51880';
$wp_version = '5.9-alpha-51881';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.