Changeset 42343 for trunk/src/wp-includes/class-walker-nav-menu.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/class-walker-nav-menu.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-walker-nav-menu.php
r41955 r42343 35 35 * @see Walker::$db_fields 36 36 */ 37 public $db_fields = array( 'parent' => 'menu_item_parent', 'id' => 'db_id' ); 37 public $db_fields = array( 38 'parent' => 'menu_item_parent', 39 'id' => 'db_id', 40 ); 38 41 39 42 /** … … 95 98 $n = "\n"; 96 99 } 97 $indent = str_repeat( $t, $depth );100 $indent = str_repeat( $t, $depth ); 98 101 $output .= "$indent</ul>{$n}"; 99 102 } … … 123 126 $indent = ( $depth ) ? str_repeat( $t, $depth ) : ''; 124 127 125 $classes = empty( $item->classes ) ? array() : (array) $item->classes;128 $classes = empty( $item->classes ) ? array() : (array) $item->classes; 126 129 $classes[] = 'menu-item-' . $item->ID; 127 130 … … 162 165 * @param int $depth Depth of menu item. Used for padding. 163 166 */ 164 $id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args, $depth );167 $id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args, $depth ); 165 168 $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; 166 169 167 $output .= $indent . '<li' . $id . $class_names . '>';168 169 $atts = array();170 $output .= $indent . '<li' . $id . $class_names . '>'; 171 172 $atts = array(); 170 173 $atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : ''; 171 $atts['target'] = ! empty( $item->target ) ? $item->target: '';172 $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn: '';173 $atts['href'] = ! empty( $item->url ) ? $item->url: '';174 $atts['target'] = ! empty( $item->target ) ? $item->target : ''; 175 $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : ''; 176 $atts['href'] = ! empty( $item->url ) ? $item->url : ''; 174 177 175 178 /** … … 196 199 foreach ( $atts as $attr => $value ) { 197 200 if ( ! empty( $value ) ) { 198 $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );201 $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); 199 202 $attributes .= ' ' . $attr . '="' . $value . '"'; 200 203 } … … 216 219 $title = apply_filters( 'nav_menu_item_title', $title, $item, $args, $depth ); 217 220 218 $item_output = $args->before;219 $item_output .= '<a' . $attributes .'>';221 $item_output = $args->before; 222 $item_output .= '<a' . $attributes . '>'; 220 223 $item_output .= $args->link_before . $title . $args->link_after; 221 224 $item_output .= '</a>';
Note: See TracChangeset
for help on using the changeset viewer.