98 break; |
98 break; |
99 default: |
99 default: |
100 $label = __( 'Select Post' ); |
100 $label = __( 'Select Post' ); |
101 break; |
101 break; |
102 } |
102 } |
103 |
|
104 $type_attr = current_theme_supports( 'html5', 'script' ) ? '' : ' type="text/javascript"'; |
|
105 ?> |
103 ?> |
106 |
104 |
107 <option value=""><?php echo esc_html( $label ); ?></option> |
105 <option value=""><?php echo esc_html( $label ); ?></option> |
108 <?php wp_get_archives( $dropdown_args ); ?> |
106 <?php wp_get_archives( $dropdown_args ); ?> |
109 |
107 |
110 </select> |
108 </select> |
111 |
109 |
112 <script<?php echo $type_attr; ?>> |
110 <?php ob_start(); ?> |
113 /* <![CDATA[ */ |
111 <script> |
114 (function() { |
112 (function() { |
115 var dropdown = document.getElementById( "<?php echo esc_js( $dropdown_id ); ?>" ); |
113 var dropdown = document.getElementById( "<?php echo esc_js( $dropdown_id ); ?>" ); |
116 function onSelectChange() { |
114 function onSelectChange() { |
117 if ( dropdown.options[ dropdown.selectedIndex ].value !== '' ) { |
115 if ( dropdown.options[ dropdown.selectedIndex ].value !== '' ) { |
118 document.location.href = this.options[ this.selectedIndex ].value; |
116 document.location.href = this.options[ this.selectedIndex ].value; |
119 } |
117 } |
120 } |
118 } |
121 dropdown.onchange = onSelectChange; |
119 dropdown.onchange = onSelectChange; |
122 })(); |
120 })(); |
123 /* ]]> */ |
|
124 </script> |
121 </script> |
125 <?php |
122 <?php |
|
123 wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_get_clean() ) ); |
126 } else { |
124 } else { |
127 $format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml'; |
125 $format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml'; |
128 |
126 |
129 /** This filter is documented in wp-includes/widgets/class-wp-nav-menu-widget.php */ |
127 /** This filter is documented in wp-includes/widgets/class-wp-nav-menu-widget.php */ |
130 $format = apply_filters( 'navigation_widgets_format', $format ); |
128 $format = apply_filters( 'navigation_widgets_format', $format ); |
221 <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" /> |
219 <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" /> |
222 </p> |
220 </p> |
223 <p> |
221 <p> |
224 <input class="checkbox" type="checkbox"<?php checked( $instance['dropdown'] ); ?> id="<?php echo $this->get_field_id( 'dropdown' ); ?>" name="<?php echo $this->get_field_name( 'dropdown' ); ?>" /> |
222 <input class="checkbox" type="checkbox"<?php checked( $instance['dropdown'] ); ?> id="<?php echo $this->get_field_id( 'dropdown' ); ?>" name="<?php echo $this->get_field_name( 'dropdown' ); ?>" /> |
225 <label for="<?php echo $this->get_field_id( 'dropdown' ); ?>"><?php _e( 'Display as dropdown' ); ?></label> |
223 <label for="<?php echo $this->get_field_id( 'dropdown' ); ?>"><?php _e( 'Display as dropdown' ); ?></label> |
226 <br/> |
224 <br /> |
227 <input class="checkbox" type="checkbox"<?php checked( $instance['count'] ); ?> id="<?php echo $this->get_field_id( 'count' ); ?>" name="<?php echo $this->get_field_name( 'count' ); ?>" /> |
225 <input class="checkbox" type="checkbox"<?php checked( $instance['count'] ); ?> id="<?php echo $this->get_field_id( 'count' ); ?>" name="<?php echo $this->get_field_name( 'count' ); ?>" /> |
228 <label for="<?php echo $this->get_field_id( 'count' ); ?>"><?php _e( 'Show post counts' ); ?></label> |
226 <label for="<?php echo $this->get_field_id( 'count' ); ?>"><?php _e( 'Show post counts' ); ?></label> |
229 </p> |
227 </p> |
230 <?php |
228 <?php |
231 } |
229 } |