Changeset 13388
- Timestamp:
- 02/24/2010 09:33:27 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/default-widgets.php
r13378 r13388 1067 1067 $navwidgetdescription = $instance['navwidgetdescription']; 1068 1068 } 1069 $menuexists = false; 1070 1071 global $wpdb; 1072 1073 // GET menu name 1069 1070 // Get menu 1074 1071 if ( $navmenu > 0 ) { 1075 1072 $custom_menu = get_term( (int) $nav_menu, 'nav_menu' ); … … 1079 1076 $menuexists = false; 1080 1077 } 1081 ?> 1082 1083 <?php 1084 //DEVELOPER settings enabled 1085 if ( $navdeveloper == 'yes' ) { 1086 //DISPLAY Custom DIV 1087 if ( $navdiv == 'yes' ) { 1088 ?> 1089 <div id="<?php echo $navdivid; ?>" class="<?php echo $navdivclass; ?>"> 1090 <?php 1078 1079 if ( $navdeveloper == 'yes' ) { 1080 // DISPLAY Custom DIV 1081 if ( $navdiv == 'yes' ) { 1082 ?> 1083 <div id="<?php echo $navdivid; ?>" class="<?php echo $navdivclass; ?>"> 1084 <?php 1091 1085 } 1092 } 1093 //DISPLAY default DIV 1094 else { 1086 } else { 1087 //DISPLAY default DIV 1095 1088 ?> 1096 1089 <div class="widget"> … … 1099 1092 ?> 1100 1093 1101 <h3><?php echo $navtitle; ?></h3> 1102 <?php 1103 1104 if ( $menuexists ) { 1105 ?> 1106 <?php 1107 1108 //DEVELOPER settings enabled 1109 if ( $navdeveloper == 'yes' ) { 1110 //DISPLAY Custom UL 1111 if ( $navul == 'yes' ) { 1112 ?> 1113 <ul id="<?php echo $navulid; ?>" class="<?php echo $navulclass; ?>"> 1114 <?php 1115 } 1116 } 1117 //DISPLAY default UL 1118 else { 1094 <h3><?php echo $navtitle; ?></h3> 1095 <?php 1096 if ( $menuexists ) { 1097 if ( $navdeveloper == 'yes' ) { 1098 //DISPLAY Custom UL 1099 if ( $navul == 'yes' ) { 1119 1100 ?> 1120 <ul class="custom-nav">1101 <ul id="<?php echo $navulid; ?>" class="<?php echo $navulclass; ?>"> 1121 1102 <?php 1122 1103 } 1123 wp_nav_menu( array('id' => $navmenu, 'name' => $wp_custom_nav_menu_name, 'desc' => $navwidgetdescription, 'format' => 'widget') ); 1124 //DEVELOPER settings enabled 1125 if ( $navdeveloper == 'yes' ) { 1126 //DISPLAY Custom UL 1127 if ( $navul == 'yes' ) { 1128 ?> 1129 </ul> 1130 <?php 1131 } 1132 } 1133 //DISPLAY default UL 1134 else { 1135 ?> 1136 </ul> 1137 <?php 1138 } 1139 1104 } else { 1105 // DISPLAY default UL 1140 1106 ?> 1141 <?php 1142 } else { 1143 _e('You have not setup the custom navigation widget correctly, please check your settings in the backend.'); 1107 <ul class="custom-nav"> 1108 <?php 1144 1109 } 1145 ?> 1146 <?php 1147 //DEVELOPER settings enabled 1148 if ($navdeveloper == 'yes') { 1149 //DISPLAY Custom DIV 1150 if ($navdiv == 'yes') 1151 { 1110 wp_nav_menu( array('id' => $navmenu, 'name' => $wp_custom_nav_menu_name, 'desc' => $navwidgetdescription, 'format' => 'widget') ); 1111 if ( $navdeveloper == 'yes' ) { 1112 //DISPLAY Custom UL 1113 if ( $navul == 'yes' ) { 1152 1114 ?> 1153 </ div>1115 </ul> 1154 1116 <?php 1155 1117 } 1156 //Do NOT display DIV 1157 else 1158 { 1159 1160 } 1161 1118 } else { 1119 //DISPLAY default UL 1120 ?> 1121 </ul> 1122 <?php 1162 1123 } 1163 //DISPLAY default DIV 1164 else 1165 { 1124 } else { 1125 _e('You have not setup the custom navigation widget correctly, please check your settings in the backend.'); 1126 } 1127 1128 //DEVELOPER settings enabled 1129 if ($navdeveloper == 'yes') { 1130 // DISPLAY Custom DIV 1131 if ( $navdiv == 'yes' ) { 1166 1132 ?> 1167 1133 </div> 1168 1134 <?php 1169 1135 } 1136 } else { 1137 // DISPLAY default DIV 1138 ?> 1139 </div> 1140 <?php 1141 } 1170 1142 ?><!-- /#nav-container --> 1171 1172 <?php 1143 <?php 1173 1144 } 1174 1145 … … 1194 1165 $custom_menus = get_terms( 'nav_menu', array( 'hide_empty' => false ) ); 1195 1166 1196 if ( $custom_menus ) { 1197 ?> 1198 1199 <p> 1200 <label for="<?php echo $this->get_field_id('navmenu'); ?>"><?php _e('Select Menu:'); ?></label> 1201 1202 <select id="<?php echo $this->get_field_id('navmenu'); ?>" name="<?php echo $this->get_field_name('navmenu'); ?>"> 1167 if ( !$custom_menus) { 1168 ?> 1169 <p> 1170 <label><?php printf(__('No menus have been created yet. <a href="%s">Creat some</a>.'), admin_url('nav-menus.php')); ?></label> 1171 </p> 1172 <?php 1173 return; 1174 } 1175 ?> 1176 1177 <p> 1178 <label for="<?php echo $this->get_field_id('navmenu'); ?>"><?php _e('Select Menu:'); ?></label> 1179 1180 <select id="<?php echo $this->get_field_id('navmenu'); ?>" name="<?php echo $this->get_field_name('navmenu'); ?>"> 1181 <?php 1182 foreach ( $custom_menus as $menu ) { 1183 if ( $navmenu == $menu->term_id ) 1184 $selected_option = 'selected="selected"'; 1185 else 1186 $selected_option = ''; 1187 ?> 1188 <option value="<?php echo $menu->term_id; ?>" <?php echo $selected_option; ?>><?php echo $menu->name; ?></option> 1203 1189 <?php 1204 1205 //DISPLAY SELECT OPTIONS 1206 foreach ( $custom_menus as $menu ) { 1207 if ( $navmenu == $menu->term_id) { 1208 $selected_option = 'selected="selected"'; 1209 } else { 1210 $selected_option = ''; 1211 } 1212 ?> 1213 <option value="<?php echo $menu->term_id; ?>" <?php echo $selected_option; ?>><?php echo $menu->name; ?></option> 1214 <?php 1215 1216 } 1217 ?> 1218 </select> 1219 1220 </p> 1221 1222 <p> 1223 <label for="<?php echo $this->get_field_id('navtitle'); ?>"><?php _e('Title:'); ?></label> 1224 <input type="text" name="<?php echo $this->get_field_name('navtitle'); ?>" value="<?php echo $navtitle; ?>" class="widefat" id="<?php echo $this->get_field_id('navtitle'); ?>" /> 1225 </p> 1226 1227 <p> 1228 <?php 1229 $checked = strtolower($navdeveloper); 1230 ?> 1231 1190 } 1191 ?> 1192 </select> 1193 </p> 1194 1195 <p> 1196 <label for="<?php echo $this->get_field_id('navtitle'); ?>"><?php _e('Title:'); ?></label> 1197 <input type="text" name="<?php echo $this->get_field_name('navtitle'); ?>" value="<?php echo $navtitle; ?>" class="widefat" id="<?php echo $this->get_field_id('navtitle'); ?>" /> 1198 </p> 1199 1200 <?php $checked = strtolower($navdeveloper); ?> 1201 <p> 1232 1202 <label for="<?php echo $this->get_field_id('navdeveloper'); ?>"><?php _e('Advanced Options:'); ?></label><br /> 1233 1203 <span class="checkboxes"> 1234 1235 1204 <label>Yes</label><input type="radio" id="<?php echo $this->get_field_name('navdeveloper'); ?>" name="<?php echo $this->get_field_name('navdeveloper'); ?>" value="yes" <?php if ($checked=='yes') { echo 'checked="checked"'; } ?> /> 1205 <label>No</label><input type="radio" id="<?php echo $this->get_field_name('navdeveloper'); ?>" name="<?php echo $this->get_field_name('navdeveloper'); ?>" value="no" <?php if ($checked=='yes') { } else { echo 'checked="checked"'; } ?> /> 1236 1206 </span><!-- /.checkboxes --> 1237 1207 </p> 1208 1209 <?php 1210 // Advanced settings 1211 if ( $checked == 'yes' ) : 1212 ?> 1213 <p> 1214 <?php $checked = strtolower($navdiv); ?> 1215 <label for="<?php echo $this->get_field_id('navdiv'); ?>"><?php _e('Wrap in container DIV:'); ?></label><br /> 1216 <span class="checkboxes"> 1217 <label>Yes</label><input type="radio" id="<?php echo $this->get_field_name('navdiv'); ?>" name="<?php echo $this->get_field_name('navdiv'); ?>" value="yes" <?php if ($checked=='yes') { echo 'checked="checked"'; } ?> /> 1218 <label>No</label><input type="radio" id="<?php echo $this->get_field_name('navdiv'); ?>" name="<?php echo $this->get_field_name('navdiv'); ?>" value="no" <?php if ($checked=='yes') { } else { echo 'checked="checked"'; } ?> /> 1219 </span><!-- /.checkboxes --> 1220 </p> 1221 <?php 1222 if ( $checked == 'yes' ) { 1223 ?> 1224 1225 <p> 1226 <label for="<?php echo $this->get_field_id('navdivid'); ?>"><?php _e('DIV id:'); ?></label> 1227 <input type="text" name="<?php echo $this->get_field_name('navdivid'); ?>" value="<?php echo $navdivid; ?>" class="widefat" id="<?php echo $this->get_field_id('navdivid'); ?>" /> 1238 1228 </p> 1239 1240 <?php 1241 1242 //DEVELOPER settings 1243 if ($checked == 'yes') 1244 { 1245 ?> 1246 1247 <p> 1248 <?php 1249 $checked = strtolower($navdiv); 1250 ?> 1251 1252 <label for="<?php echo $this->get_field_id('navdiv'); ?>"><?php _e('Wrap in container DIV:'); ?></label><br /> 1253 <span class="checkboxes"> 1254 <label>Yes</label><input type="radio" id="<?php echo $this->get_field_name('navdiv'); ?>" name="<?php echo $this->get_field_name('navdiv'); ?>" value="yes" <?php if ($checked=='yes') { echo 'checked="checked"'; } ?> /> 1255 <label>No</label><input type="radio" id="<?php echo $this->get_field_name('navdiv'); ?>" name="<?php echo $this->get_field_name('navdiv'); ?>" value="no" <?php if ($checked=='yes') { } else { echo 'checked="checked"'; } ?> /> 1256 </span><!-- /.checkboxes --> 1257 1229 <p> 1230 <label for="<?php echo $this->get_field_id('navdivclass'); ?>"><?php _e('DIV class:'); ?></label> 1231 <input type="text" name="<?php echo $this->get_field_name('navdivclass'); ?>" value="<?php echo $navdivclass; ?>" class="widefat" id="<?php echo $this->get_field_id('navdivclass'); ?>" /> 1258 1232 </p> 1259 1260 <?php 1261 1262 if ( $checked == 'yes' ) { 1263 1264 ?> 1265 1266 <p> 1267 1268 <label for="<?php echo $this->get_field_id('navdivid'); ?>"><?php _e('DIV id:'); ?></label> 1269 <input type="text" name="<?php echo $this->get_field_name('navdivid'); ?>" value="<?php echo $navdivid; ?>" class="widefat" id="<?php echo $this->get_field_id('navdivid'); ?>" /> 1270 </p> 1271 <p> 1272 1273 <label for="<?php echo $this->get_field_id('navdivclass'); ?>"><?php _e('DIV class:'); ?></label> 1274 <input type="text" name="<?php echo $this->get_field_name('navdivclass'); ?>" value="<?php echo $navdivclass; ?>" class="widefat" id="<?php echo $this->get_field_id('navdivclass'); ?>" /> 1275 </p> 1276 1277 <?php 1278 1279 } 1280 1281 ?> 1282 1233 <?php 1234 } 1235 1236 $checked = strtolower($navul); 1237 ?> 1238 1239 <p> 1240 <label for="<?php echo $this->get_field_id('navul'); ?>"><?php _e('Wrap in container UL:'); ?></label><br /> 1241 <span class="checkboxes"> 1242 <label>Yes</label><input type="radio" id="<?php echo $this->get_field_name('navul'); ?>" name="<?php echo $this->get_field_name('navul'); ?>" value="yes" <?php if ($checked=='yes') { echo 'checked="checked"'; } ?> /> 1243 <label>No</label><input type="radio" id="<?php echo $this->get_field_name('navul'); ?>" name="<?php echo $this->get_field_name('navul'); ?>" value="no" <?php if ($checked=='yes') { } else { echo 'checked="checked"'; } ?> /> 1244 </span><!-- /.checkboxes --> 1245 </p> 1246 1247 <?php 1248 if ( $checked == 'yes' ) { 1249 ?> 1283 1250 <p> 1284 <?php 1285 $checked = strtolower($navul); 1286 ?> 1287 1288 <label for="<?php echo $this->get_field_id('navul'); ?>"><?php _e('Wrap in container UL:'); ?></label><br /> 1289 <span class="checkboxes"> 1290 <label>Yes</label><input type="radio" id="<?php echo $this->get_field_name('navul'); ?>" name="<?php echo $this->get_field_name('navul'); ?>" value="yes" <?php if ($checked=='yes') { echo 'checked="checked"'; } ?> /> 1291 <label>No</label><input type="radio" id="<?php echo $this->get_field_name('navul'); ?>" name="<?php echo $this->get_field_name('navul'); ?>" value="no" <?php if ($checked=='yes') { } else { echo 'checked="checked"'; } ?> /> 1292 </span><!-- /.checkboxes --> 1293 1251 <label for="<?php echo $this->get_field_id('navulid'); ?>"><?php _e('UL id:'); ?></label> 1252 <input type="text" name="<?php echo $this->get_field_name('navulid'); ?>" value="<?php echo $navulid; ?>" class="widefat" id="<?php echo $this->get_field_id('navulid'); ?>" /> 1294 1253 </p> 1295 1296 <?php1297 1298 if ($checked == 'yes')1299 {1300 1301 ?>1302 1303 <p>1304 1305 <label for="<?php echo $this->get_field_id('navulid'); ?>"><?php _e('UL id:'); ?></label>1306 <input type="text" name="<?php echo $this->get_field_name('navulid'); ?>" value="<?php echo $navulid; ?>" class="widefat" id="<?php echo $this->get_field_id('navulid'); ?>" />1307 </p>1308 <p>1309 1310 <label for="<?php echo $this->get_field_id('navulclass'); ?>"><?php _e('UL class:'); ?></label>1311 <input type="text" name="<?php echo $this->get_field_name('navulclass'); ?>" value="<?php echo $navulclass; ?>" class="widefat" id="<?php echo $this->get_field_id('navulclass'); ?>" />1312 </p>1313 1314 <?php1315 1316 }1317 1318 ?>1319 <?php $advanced_option_descriptions = get_option('wp_settings_custom_nav_advanced_options'); ?>1320 <p <?php if ($advanced_option_descriptions == 'no') { ?>style="display:none;"<?php } ?>>1321 1322 <?php1323 $checked = strtolower($navwidgetdescription);1324 ?>1325 1326 <label for="<?php echo $this->get_field_id('navwidgetdescription'); ?>"><?php _e('Show Top Level Descriptions:'); ?></label><br />1327 <span class="checkboxes">1328 <label>Yes</label><input type="radio" id="<?php echo $this->get_field_name('navwidgetdescription'); ?>" name="<?php echo $this->get_field_name('navwidgetdescription'); ?>" value="1" <?php if ($checked=='1') { echo 'checked="checked"'; } ?> />1329 <label>No</label><input type="radio" id="<?php echo $this->get_field_name('navwidgetdescription'); ?>" name="<?php echo $this->get_field_name('navwidgetdescription'); ?>" value="2" <?php if ($checked=='1') { } else { echo 'checked="checked"'; } ?> />1330 </span><!-- /.checkboxes -->1331 </p>1332 <?php1333 }1334 //Do nothing1335 else1336 {1337 1338 }1339 1340 }1341 //Error message for menus not existing1342 else1343 {1344 ?>1345 1254 <p> 1346 <label><?php _e('The Custom Navigation has not been configured correctly. Please check your Custom Navigation settings before adding this widget.'); ?></label> 1255 <label for="<?php echo $this->get_field_id('navulclass'); ?>"><?php _e('UL class:'); ?></label> 1256 <input type="text" name="<?php echo $this->get_field_name('navulclass'); ?>" value="<?php echo $navulclass; ?>" class="widefat" id="<?php echo $this->get_field_id('navulclass'); ?>" /> 1347 1257 </p> 1348 <?php 1349 } 1350 } 1351 1258 <?php 1259 } 1260 $advanced_option_descriptions = get_option('wp_settings_custom_nav_advanced_options'); 1261 ?> 1262 <p <?php if ($advanced_option_descriptions == 'no') { ?>style="display:none;"<?php } ?>> 1263 <?php $checked = strtolower($navwidgetdescription); ?> 1264 <label for="<?php echo $this->get_field_id('navwidgetdescription'); ?>"><?php _e('Show Top Level Descriptions:'); ?></label><br /> 1265 <span class="checkboxes"> 1266 <label>Yes</label><input type="radio" id="<?php echo $this->get_field_name('navwidgetdescription'); ?>" name="<?php echo $this->get_field_name('navwidgetdescription'); ?>" value="1" <?php if ($checked=='1') { echo 'checked="checked"'; } ?> /> 1267 <label>No</label><input type="radio" id="<?php echo $this->get_field_name('navwidgetdescription'); ?>" name="<?php echo $this->get_field_name('navwidgetdescription'); ?>" value="2" <?php if ($checked=='1') { } else { echo 'checked="checked"'; } ?> /> 1268 </span><!-- /.checkboxes --> 1269 </p> 1270 <?php 1271 endif; 1272 } 1352 1273 } 1353 1274
Note: See TracChangeset
for help on using the changeset viewer.