wp/wp-includes/class-walker-category.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
   180 			if ( empty( $args['feed_image'] ) ) {
   180 			if ( empty( $args['feed_image'] ) ) {
   181 				$link .= $name;
   181 				$link .= $name;
   182 			} else {
   182 			} else {
   183 				$link .= "<img src='" . esc_url( $args['feed_image'] ) . "'$alt" . ' />';
   183 				$link .= "<img src='" . esc_url( $args['feed_image'] ) . "'$alt" . ' />';
   184 			}
   184 			}
       
   185 
   185 			$link .= '</a>';
   186 			$link .= '</a>';
   186 
   187 
   187 			if ( empty( $args['feed_image'] ) ) {
   188 			if ( empty( $args['feed_image'] ) ) {
   188 				$link .= ')';
   189 				$link .= ')';
   189 			}
   190 			}
   190 		}
   191 		}
   191 
   192 
   192 		if ( ! empty( $args['show_count'] ) ) {
   193 		if ( ! empty( $args['show_count'] ) ) {
   193 			$link .= ' (' . number_format_i18n( $category->count ) . ')';
   194 			$link .= ' (' . number_format_i18n( $category->count ) . ')';
   194 		}
   195 		}
       
   196 
   195 		if ( 'list' === $args['style'] ) {
   197 		if ( 'list' === $args['style'] ) {
   196 			$output     .= "\t<li";
   198 			$output     .= "\t<li";
   197 			$css_classes = array(
   199 			$css_classes = array(
   198 				'cat-item',
   200 				'cat-item',
   199 				'cat-item-' . $category->term_id,
   201 				'cat-item-' . $category->term_id,
   208 						'hide_empty' => false,
   210 						'hide_empty' => false,
   209 					)
   211 					)
   210 				);
   212 				);
   211 
   213 
   212 				foreach ( $_current_terms as $_current_term ) {
   214 				foreach ( $_current_terms as $_current_term ) {
   213 					if ( $category->term_id == $_current_term->term_id ) {
   215 					if ( $category->term_id === $_current_term->term_id ) {
   214 						$css_classes[] = 'current-cat';
   216 						$css_classes[] = 'current-cat';
   215 						$link          = str_replace( '<a', '<a aria-current="page"', $link );
   217 						$link          = str_replace( '<a', '<a aria-current="page"', $link );
   216 					} elseif ( $category->term_id == $_current_term->parent ) {
   218 					} elseif ( $category->term_id === $_current_term->parent ) {
   217 						$css_classes[] = 'current-cat-parent';
   219 						$css_classes[] = 'current-cat-parent';
   218 					}
   220 					}
       
   221 
   219 					while ( $_current_term->parent ) {
   222 					while ( $_current_term->parent ) {
   220 						if ( $category->term_id == $_current_term->parent ) {
   223 						if ( $category->term_id === $_current_term->parent ) {
   221 							$css_classes[] = 'current-cat-ancestor';
   224 							$css_classes[] = 'current-cat-ancestor';
   222 							break;
   225 							break;
   223 						}
   226 						}
       
   227 
   224 						$_current_term = get_term( $_current_term->parent, $category->taxonomy );
   228 						$_current_term = get_term( $_current_term->parent, $category->taxonomy );
   225 					}
   229 					}
   226 				}
   230 				}
   227 			}
   231 			}
   228 
   232 
   269 			return;
   273 			return;
   270 		}
   274 		}
   271 
   275 
   272 		$output .= "</li>\n";
   276 		$output .= "</li>\n";
   273 	}
   277 	}
   274 
       
   275 }
   278 }