- Timestamp:
- 07/06/2020 08:42:14 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/widgets/class-wp-nav-menu-widget.php
r47122 r48349 47 47 } 48 48 49 $title = ! empty( $instance['title'] ) ? $instance['title'] : ''; 49 $default_title = __( 'Menu' ); 50 $title = ! empty( $instance['title'] ) ? $instance['title'] : ''; 50 51 51 52 /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ … … 58 59 } 59 60 60 $nav_menu_args = array( 61 'fallback_cb' => '', 62 'menu' => $nav_menu, 63 ); 61 $format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml'; 62 63 /** 64 * Filters the HTML format of widgets with navigation links. 65 * 66 * @since 5.5.0 67 * 68 * @param string $format The type of markup to use in widgets with navigation links. 69 * Accepts 'html5', 'xhtml'. 70 */ 71 $format = apply_filters( 'navigation_widgets_format', $format ); 72 73 if ( 'html5' === $format ) { 74 // The title may be filtered: Strip out HTML and make sure the aria-label is never empty. 75 $title = trim( strip_tags( $title ) ); 76 $aria_label = $title ? $title : $default_title; 77 78 $nav_menu_args = array( 79 'fallback_cb' => '', 80 'menu' => $nav_menu, 81 'container' => 'nav', 82 'container_aria_label' => $aria_label, 83 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', 84 ); 85 } else { 86 $nav_menu_args = array( 87 'fallback_cb' => '', 88 'menu' => $nav_menu, 89 ); 90 } 64 91 65 92 /**
Note: See TracChangeset
for help on using the changeset viewer.