equal
deleted
inserted
replaced
120 $css_class[] = 'page_item_has_children'; |
120 $css_class[] = 'page_item_has_children'; |
121 } |
121 } |
122 |
122 |
123 if ( ! empty( $current_page ) ) { |
123 if ( ! empty( $current_page ) ) { |
124 $_current_page = get_post( $current_page ); |
124 $_current_page = get_post( $current_page ); |
125 if ( $_current_page && in_array( $page->ID, $_current_page->ancestors ) ) { |
125 |
|
126 if ( $_current_page && in_array( $page->ID, $_current_page->ancestors, true ) ) { |
126 $css_class[] = 'current_page_ancestor'; |
127 $css_class[] = 'current_page_ancestor'; |
127 } |
128 } |
|
129 |
128 if ( $page->ID == $current_page ) { |
130 if ( $page->ID == $current_page ) { |
129 $css_class[] = 'current_page_item'; |
131 $css_class[] = 'current_page_item'; |
130 } elseif ( $_current_page && $page->ID == $_current_page->post_parent ) { |
132 } elseif ( $_current_page && $page->ID === $_current_page->post_parent ) { |
131 $css_class[] = 'current_page_parent'; |
133 $css_class[] = 'current_page_parent'; |
132 } |
134 } |
133 } elseif ( $page->ID == get_option( 'page_for_posts' ) ) { |
135 } elseif ( get_option( 'page_for_posts' ) == $page->ID ) { |
134 $css_class[] = 'current_page_parent'; |
136 $css_class[] = 'current_page_parent'; |
135 } |
137 } |
136 |
138 |
137 /** |
139 /** |
138 * Filters the list of CSS classes to include with each page item in the list. |
140 * Filters the list of CSS classes to include with each page item in the list. |
149 */ |
151 */ |
150 $css_classes = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ) ); |
152 $css_classes = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ) ); |
151 $css_classes = $css_classes ? ' class="' . esc_attr( $css_classes ) . '"' : ''; |
153 $css_classes = $css_classes ? ' class="' . esc_attr( $css_classes ) . '"' : ''; |
152 |
154 |
153 if ( '' === $page->post_title ) { |
155 if ( '' === $page->post_title ) { |
154 /* translators: %d: ID of a post */ |
156 /* translators: %d: ID of a post. */ |
155 $page->post_title = sprintf( __( '#%d (no title)' ), $page->ID ); |
157 $page->post_title = sprintf( __( '#%d (no title)' ), $page->ID ); |
156 } |
158 } |
157 |
159 |
158 $args['link_before'] = empty( $args['link_before'] ) ? '' : $args['link_before']; |
160 $args['link_before'] = empty( $args['link_before'] ) ? '' : $args['link_before']; |
159 $args['link_after'] = empty( $args['link_after'] ) ? '' : $args['link_after']; |
161 $args['link_after'] = empty( $args['link_after'] ) ? '' : $args['link_after']; |
180 */ |
182 */ |
181 $atts = apply_filters( 'page_menu_link_attributes', $atts, $page, $depth, $args, $current_page ); |
183 $atts = apply_filters( 'page_menu_link_attributes', $atts, $page, $depth, $args, $current_page ); |
182 |
184 |
183 $attributes = ''; |
185 $attributes = ''; |
184 foreach ( $atts as $attr => $value ) { |
186 foreach ( $atts as $attr => $value ) { |
185 if ( ! empty( $value ) ) { |
187 if ( is_scalar( $value ) && '' !== $value && false !== $value ) { |
186 $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); |
188 $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); |
187 $attributes .= ' ' . $attr . '="' . $value . '"'; |
189 $attributes .= ' ' . $attr . '="' . $value . '"'; |
188 } |
190 } |
189 } |
191 } |
190 |
192 |
197 apply_filters( 'the_title', $page->post_title, $page->ID ), |
199 apply_filters( 'the_title', $page->post_title, $page->ID ), |
198 $args['link_after'] |
200 $args['link_after'] |
199 ); |
201 ); |
200 |
202 |
201 if ( ! empty( $args['show_date'] ) ) { |
203 if ( ! empty( $args['show_date'] ) ) { |
202 if ( 'modified' == $args['show_date'] ) { |
204 if ( 'modified' === $args['show_date'] ) { |
203 $time = $page->post_modified; |
205 $time = $page->post_modified; |
204 } else { |
206 } else { |
205 $time = $page->post_date; |
207 $time = $page->post_date; |
206 } |
208 } |
207 |
209 |