equal
deleted
inserted
replaced
70 * |
70 * |
71 * @param string[] $classes Array of the CSS classes that are applied to the menu `<ul>` element. |
71 * @param string[] $classes Array of the CSS classes that are applied to the menu `<ul>` element. |
72 * @param stdClass $args An object of `wp_nav_menu()` arguments. |
72 * @param stdClass $args An object of `wp_nav_menu()` arguments. |
73 * @param int $depth Depth of menu item. Used for padding. |
73 * @param int $depth Depth of menu item. Used for padding. |
74 */ |
74 */ |
75 $class_names = join( ' ', apply_filters( 'nav_menu_submenu_css_class', $classes, $args, $depth ) ); |
75 $class_names = implode( ' ', apply_filters( 'nav_menu_submenu_css_class', $classes, $args, $depth ) ); |
76 $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; |
76 $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; |
77 |
77 |
78 $output .= "{$n}{$indent}<ul$class_names>{$n}"; |
78 $output .= "{$n}{$indent}<ul$class_names>{$n}"; |
79 } |
79 } |
80 |
80 |
148 * @param string[] $classes Array of the CSS classes that are applied to the menu item's `<li>` element. |
148 * @param string[] $classes Array of the CSS classes that are applied to the menu item's `<li>` element. |
149 * @param WP_Post $item The current menu item. |
149 * @param WP_Post $item The current menu item. |
150 * @param stdClass $args An object of wp_nav_menu() arguments. |
150 * @param stdClass $args An object of wp_nav_menu() arguments. |
151 * @param int $depth Depth of menu item. Used for padding. |
151 * @param int $depth Depth of menu item. Used for padding. |
152 */ |
152 */ |
153 $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args, $depth ) ); |
153 $class_names = implode( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args, $depth ) ); |
154 $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; |
154 $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; |
155 |
155 |
156 /** |
156 /** |
157 * Filters the ID applied to a menu item's list item element. |
157 * Filters the ID applied to a menu item's list item element. |
158 * |
158 * |
171 |
171 |
172 $atts = array(); |
172 $atts = array(); |
173 $atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : ''; |
173 $atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : ''; |
174 $atts['target'] = ! empty( $item->target ) ? $item->target : ''; |
174 $atts['target'] = ! empty( $item->target ) ? $item->target : ''; |
175 if ( '_blank' === $item->target && empty( $item->xfn ) ) { |
175 if ( '_blank' === $item->target && empty( $item->xfn ) ) { |
176 $atts['rel'] = 'noopener noreferrer'; |
176 $atts['rel'] = 'noopener'; |
177 } else { |
177 } else { |
178 $atts['rel'] = $item->xfn; |
178 $atts['rel'] = $item->xfn; |
179 } |
179 } |
180 $atts['href'] = ! empty( $item->url ) ? $item->url : ''; |
180 $atts['href'] = ! empty( $item->url ) ? $item->url : ''; |
181 $atts['aria-current'] = $item->current ? 'page' : ''; |
181 $atts['aria-current'] = $item->current ? 'page' : ''; |
191 * |
191 * |
192 * @type string $title Title attribute. |
192 * @type string $title Title attribute. |
193 * @type string $target Target attribute. |
193 * @type string $target Target attribute. |
194 * @type string $rel The rel attribute. |
194 * @type string $rel The rel attribute. |
195 * @type string $href The href attribute. |
195 * @type string $href The href attribute. |
196 * @type string $aria_current The aria-current attribute. |
196 * @type string $aria-current The aria-current attribute. |
197 * } |
197 * } |
198 * @param WP_Post $item The current menu item. |
198 * @param WP_Post $item The current menu item. |
199 * @param stdClass $args An object of wp_nav_menu() arguments. |
199 * @param stdClass $args An object of wp_nav_menu() arguments. |
200 * @param int $depth Depth of menu item. Used for padding. |
200 * @param int $depth Depth of menu item. Used for padding. |
201 */ |
201 */ |