60 * @param int $current_object_id Optional. ID of the current page. Default 0. |
60 * @param int $current_object_id Optional. ID of the current page. Default 0. |
61 */ |
61 */ |
62 public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) { |
62 public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) { |
63 // Restores the more descriptive, specific name for use within this method. |
63 // Restores the more descriptive, specific name for use within this method. |
64 $page = $data_object; |
64 $page = $data_object; |
65 $pad = str_repeat( ' ', $depth * 3 ); |
65 |
|
66 $pad = str_repeat( ' ', $depth * 3 ); |
66 |
67 |
67 if ( ! isset( $args['value_field'] ) || ! isset( $page->{$args['value_field']} ) ) { |
68 if ( ! isset( $args['value_field'] ) || ! isset( $page->{$args['value_field']} ) ) { |
68 $args['value_field'] = 'ID'; |
69 $args['value_field'] = 'ID'; |
69 } |
70 } |
70 |
71 |
71 $output .= "\t<option class=\"level-$depth\" value=\"" . esc_attr( $page->{$args['value_field']} ) . '"'; |
72 $output .= "\t<option class=\"level-$depth\" value=\"" . esc_attr( $page->{$args['value_field']} ) . '"'; |
72 if ( $page->ID == $args['selected'] ) { |
73 if ( $page->ID === (int) $args['selected'] ) { |
73 $output .= ' selected="selected"'; |
74 $output .= ' selected="selected"'; |
74 } |
75 } |
75 $output .= '>'; |
76 $output .= '>'; |
76 |
77 |
77 $title = $page->post_title; |
78 $title = $page->post_title; |