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 .

git-svn-id: https://develop.svn.wordpress.org/trunk@51881 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2021-10-02 17:04:52 +00:00
parent 1f0aed81a6
commit f660632c9c

@ -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 );