168 | | <div class="clear"></div> |
169 | | <?php endif ?> |
| 172 | <?php endif; ?> |
| 173 | |
| 174 | <div id="menus-container" class="metabox-holder has-right-sidebar"> |
| 175 | <div id="menu-settings-column" class="inner-sidebar"> |
| 176 | <div id="side-sortables" class="meta-box-sortables ui-sortable"> |
| 177 | |
| 178 | <div id="add-menu" class="postbox"> |
| 179 | <div class="handlediv" title="Click to toggle"><br /></div> |
| 180 | <h3 class="hndle"><?php esc_html_e('Add Menu'); ?></h3> |
| 181 | <div class="inside"> |
| 182 | <span> |
| 183 | <input id="add-menu-name" name="add-menu-name" type="text" value="" /> |
| 184 | <input id="add-menu" type="submit" value="<?php esc_attr_e('Add Menu'); ?>" name="add-menu" class="button" /> |
| 185 | </span> |
| 186 | </div><!-- /.inside--> |
| 187 | </div><!--END #add-menu--> |
| 188 | |
| 189 | <div id="add-pages" class="postbox"> |
| 190 | <div class="handlediv" title="Click to toggle"><br /></div> |
| 191 | <h3 class="hndle"><?php esc_html_e('Add an Existing Page'); ?></h3> |
| 192 | <div class="inside"> |
| 193 | <?php |
| 194 | $pages_args = array( |
| 195 | 'child_of' => 0, |
| 196 | 'sort_order' => 'ASC', |
| 197 | 'sort_column' => 'post_title', |
| 198 | 'hierarchical' => 1, |
| 199 | 'exclude' => '', |
| 200 | 'include' => '', |
| 201 | 'meta_key' => '', |
| 202 | 'meta_value' => '', |
| 203 | 'authors' => '', |
| 204 | 'parent' => -1, |
| 205 | 'exclude_tree' => '', |
| 206 | 'number' => '', |
| 207 | 'offset' => 0 |
| 208 | ); |
| 209 | $page_name = ''; |
| 210 | $pages_array = get_pages($pages_args); |
| 211 | if ( $pages_array ) { |
| 212 | foreach ( $pages_array as $post ) { |
| 213 | $page_name .= $post->post_title . '|'; |
| 214 | } |
| 215 | } else { |
| 216 | $page_name = __('No pages available'); |
| 217 | } |
| 218 | ?> |
| 219 | <script type="text/javascript" charset="<?php bloginfo('charset'); ?>"> |
| 220 | jQuery(document).ready(function(){ |
| 221 | var posts = "<?php echo esc_js( $page_name ); ?>".split("|"); |
| 222 | jQuery("#page-search").autocomplete(posts); |
| 223 | jQuery("#page-search").result(function(event, data, formatted) { |
| 224 | jQuery('#existing-pages').css('display','block'); |
| 225 | jQuery("#existing-pages dt:contains('" + data + "')").css("display", "block"); |
| 226 | jQuery('#show-pages').hide(); |
| 227 | jQuery('#hide-pages').show(); |
| 228 | }); |
| 229 | jQuery('#existing-pages').css('display','none'); |
| 230 | }); |
| 231 | </script> |
| 232 | <input type="text" onfocus="jQuery('#page-search').attr('value','');" id="page-search" value="<?php esc_attr_e('Search Pages'); ?>" /> |
181 | | <div class="sidebar-name"> |
182 | | <div class="sidebar-name-arrow"> |
183 | | <br/> |
184 | | </div> |
185 | | <h3><?php echo esc_html( $menu_title ); ?></h3> |
| 241 | <ul id="existing-pages" class="list"> |
| 242 | <?php $items_counter = wp_nav_menu_get_pages( 0,'default' ); ?> |
| 243 | </ul> |
| 244 | <div class="fix"></div> |
| 245 | </div><!-- /.inside--> |
| 246 | </div><!--END #add-pages--> |
| 247 | |
| 248 | <div id="add-categories" class="postbox"> |
| 249 | <div class="handlediv" title="Click to toggle"><br /></div> |
| 250 | <h3 class="hndle"><?php esc_html_e('Add an Existing Category'); ?></h3> |
| 251 | <div class="inside"> |
| 252 | <?php |
| 253 | // Custom GET categories query |
| 254 | // @todo Use API |
| 255 | $categories = $wpdb->get_results("SELECT term_id FROM $wpdb->term_taxonomy WHERE taxonomy = 'category' ORDER BY term_id ASC"); |
| 256 | $cat_name = ''; |
| 257 | if ( $categories ) { |
| 258 | foreach ( $categories as $category ) { |
| 259 | $cat_id = $category->term_id; |
| 260 | $cat_args = array( |
| 261 | 'orderby' => 'name', |
| 262 | 'include' => $cat_id, |
| 263 | 'hierarchical' => 1, |
| 264 | 'order' => 'ASC', |
| 265 | ); |
| 266 | $category_names = get_categories( $cat_args ); |
| 267 | if ( isset( $category_names[0]->name ) ) { |
| 268 | $cat_name .= htmlentities( $category_names[0]->name ).'|'; |
| 269 | } |
| 270 | } |
| 271 | } else { |
| 272 | $cat_name = __('No categories available'); |
| 273 | } |
| 274 | ?> |
| 275 | <script type="text/javascript" charset="<?php bloginfo('charset'); ?>"> |
| 276 | jQuery(document).ready(function(){ |
| 277 | var categories = "<?php echo esc_js($cat_name); ?>".split("|"); |
| 278 | jQuery("#cat-search").autocomplete(categories); |
| 279 | jQuery("#cat-search").result(function(event, data, formatted) { |
| 280 | jQuery('#existing-categories').css('display','block'); |
| 281 | jQuery("#existing-categories dt:contains('" + data + "')").css("display", "block"); |
| 282 | jQuery('#show-cats').hide(); |
| 283 | jQuery('#hide-cats').show(); |
| 284 | }); |
| 285 | jQuery('#existing-categories').css('display','none'); |
| 286 | }); |
| 287 | </script> |
202 | | <script type="text/javascript"> |
203 | | updatepostdata(); |
204 | | </script> |
205 | | <input id="save_bottom" name="save_bottom" type="submit" value="<?php esc_attr_e('Save All Changes'); ?>" /> |
206 | | <input id="delete-menu" name="delete-menu" type="submit" value="<?php esc_attr_e('Delete This Menu'); ?>" /> |
207 | | </p> |
| 302 | <div class="fix"></div> |
| 303 | </div><!-- /.inside--> |
| 304 | </div><!--END #add-categories--> |
| 305 | |
| 306 | <div id="add-external-link" class="postbox"> |
| 307 | <div class="handlediv" title="Click to toggle"><br /></div> |
| 308 | <h3 class="hndle"><?php esc_html_e('Add a Custom Link'); ?></h3> |
| 309 | <div class="inside"> |
| 310 | |
| 311 | <label class="howto" for="custom-menu-item-url"> |
| 312 | <input id="custom-menu-item-url" type="text" value="http://" /> |
| 313 | <?php _e('URL'); ?> |
| 314 | </label><br /> |
| 315 | |
| 316 | <?php $template_dir = get_bloginfo('url'); ?> |
| 317 | <input type="hidden" id="template-dir" value="<?php echo esc_attr($template_dir); ?>" /> |
| 318 | <label class="howto" for="custom-menu-item-name"> |
| 319 | <input id="custom-menu-item-name" type="text" value="<?php echo esc_attr( __('Menu Item') ); ?>" onfocus="jQuery('#custom-menu-item-name').attr('value','');" /> |
| 320 | <?php _e('Menu Text'); ?> |
| 321 | </label><br /> |
| 322 | |
| 323 | <label class="howto" for="custom_menu_item_description" <?php if ($advanced_option_descriptions == 'no') { ?>style="display:none;"<?php } ?>> |
| 324 | <input id="custom_menu_item_description" type="text" value="<?php esc_attr_e('A description'); ?>" <?php if ($advanced_option_descriptions == 'no') { ?>style="display:none;"<?php } ?> onfocus="jQuery('#custom_menu_item_description').attr('value','');" /> |
| 325 | <?php _e('Description'); ?> |
| 326 | </label> |
| 327 | |
| 328 | <?php if ( 'no' != $advanced_option_descriptions ) { echo '<br />'; } ?> |
| 329 | |
| 330 | <a class="addtomenu button" onclick="appendToList('<?php echo $template_dir; ?>','<?php echo esc_js( _x('Custom', 'menu nav item type') ); ?>','','','','0','');jQuery('#custom-menu-item-name').attr('value','<?php echo esc_js( __('Menu Item') ); ?>');jQuery('#custom_menu_item_description').attr('value','<?php echo esc_js( __('A description') ); ?>');"><?php _e('Add to menu'); ?></a> |
| 331 | <div class="fix"></div> |
| 332 | </div><!-- /.inside--> |
| 333 | </div><!-- /#add-external-link--> |
| 334 | |
| 335 | </div><!-- /#side-sortables--> |
| 336 | </div><!-- /#menu-settings-column --> |
215 | | <div id="menu-right"> |
216 | | <div class="widgets-holder-wrap"> |
217 | | <div class="sidebar-name"> |
218 | | <div class="sidebar-name-arrow"></div> |
219 | | <h3><?php esc_html_e('Add Menu'); ?></h3> |
220 | | </div> |
221 | | <div class="widget-holder"> |
222 | | |
223 | | <span> |
224 | | <input id="add-menu-name" name="add-menu-name" type="text" value="" /> |
225 | | <input id="add-menu" type="submit" value="<?php esc_attr_e('Add Menu'); ?>" name="add-menu" class="button" /> |
226 | | </span> |
227 | | </div> |
228 | | </div><!-- /.widgets-holder-wrap --> |
229 | | <div class="widgets-holder-wrap"> |
230 | | <div class="sidebar-name"> |
231 | | <div class="sidebar-name-arrow"></div> |
232 | | <h3><?php esc_html_e('Add an Existing Page'); ?></h3> |
233 | | </div> |
234 | | <div class="widget-holder"> |
235 | | <?php |
236 | | $pages_args = array( |
237 | | 'child_of' => 0, |
238 | | 'sort_order' => 'ASC', |
239 | | 'sort_column' => 'post_title', |
240 | | 'hierarchical' => 1, |
241 | | 'exclude' => '', |
242 | | 'include' => '', |
243 | | 'meta_key' => '', |
244 | | 'meta_value' => '', |
245 | | 'authors' => '', |
246 | | 'parent' => -1, |
247 | | 'exclude_tree' => '', |
248 | | 'number' => '', |
249 | | 'offset' => 0 |
250 | | ); |
251 | | $page_name = ''; |
252 | | $pages_array = get_pages($pages_args); |
253 | | if ( $pages_array ) { |
254 | | foreach ( $pages_array as $post ) { |
255 | | $page_name .= $post->post_title . '|'; |
256 | | } |
257 | | } else { |
258 | | $page_name = __('No pages available'); |
259 | | } |
260 | | ?> |
261 | | <script type="text/javascript" charset="<?php bloginfo('charset'); ?>"> |
262 | | jQuery(document).ready(function(){ |
263 | | var posts = "<?php echo esc_js( $page_name ); ?>".split("|"); |
264 | | jQuery("#page-search").autocomplete(posts); |
265 | | jQuery("#page-search").result(function(event, data, formatted) { |
266 | | jQuery('#existing-pages').css('display','block'); |
267 | | jQuery("#existing-pages dt:contains('" + data + "')").css("display", "block"); |
268 | | jQuery('#show-pages').hide(); |
269 | | jQuery('#hide-pages').show(); |
270 | | }); |
271 | | jQuery('#existing-pages').css('display','none'); |
272 | | }); |
273 | | </script> |
274 | | <input type="text" onfocus="jQuery('#page-search').attr('value','');" id="page-search" value="<?php esc_attr_e('Search Pages'); ?>" /> |
275 | | |
276 | | <a id="show-pages" style="cursor:pointer;" onclick="jQuery('#existing-pages').css('display','block');jQuery('#page-search').attr('value','');jQuery('#existing-pages dt').css('display','block');jQuery('#show-pages').hide();jQuery('#hide-pages').show();"><?php _e('View All'); ?></a> |
277 | | <a id="hide-pages" style="cursor:pointer;" onclick="jQuery('#existing-pages').css('display','none');jQuery('#page-search').attr('value','Search Pages');jQuery('#existing-pages dt').css('display','none');jQuery('#show-pages').show();jQuery('#hide-pages').hide();"><?php _e('Hide All'); ?></a> |
278 | | |
279 | | <script type="text/javascript"> |
280 | | jQuery('#hide-pages').hide(); |
281 | | </script> |
282 | | |
283 | | <ul id="existing-pages" class="list"> |
284 | | <?php |
285 | | $items_counter = wp_nav_menu_get_pages( 0,'default' ); |
286 | | ?> |
287 | | </ul> |
288 | | <div class="fix"></div> |
289 | | </div> |
290 | | </div><!-- /.widgets-holder-wrap --> |
291 | | |
292 | | <div class="widgets-holder-wrap"> |
293 | | <div class="sidebar-name"> |
294 | | <div class="sidebar-name-arrow"></div> |
295 | | <h3><?php esc_html_e('Add an Existing Category'); ?></h3> |
296 | | </div> |
297 | | <div class="widget-holder"> |
298 | | |
299 | | <?php |
300 | | // Custom GET categories query |
301 | | // @todo Use API |
302 | | $categories = $wpdb->get_results("SELECT term_id FROM $wpdb->term_taxonomy WHERE taxonomy = 'category' ORDER BY term_id ASC"); |
303 | | $cat_name = ''; |
304 | | if ( $categories ) { |
305 | | foreach ( $categories as $category ) { |
306 | | $cat_id = $category->term_id; |
307 | | $cat_args = array( |
308 | | 'orderby' => 'name', |
309 | | 'include' => $cat_id, |
310 | | 'hierarchical' => 1, |
311 | | 'order' => 'ASC', |
312 | | ); |
313 | | $category_names = get_categories( $cat_args ); |
314 | | if ( isset( $category_names[0]->name ) ) { |
315 | | $cat_name .= htmlentities( $category_names[0]->name ).'|'; |
316 | | } |
317 | | } |
318 | | } else { |
319 | | $cat_name = __('No categories available'); |
320 | | } |
321 | | ?> |
322 | | <script type="text/javascript" charset="<?php bloginfo('charset'); ?>"> |
323 | | jQuery(document).ready(function(){ |
324 | | var categories = "<?php echo esc_js($cat_name); ?>".split("|"); |
325 | | jQuery("#cat-search").autocomplete(categories); |
326 | | jQuery("#cat-search").result(function(event, data, formatted) { |
327 | | jQuery('#existing-categories').css('display','block'); |
328 | | jQuery("#existing-categories dt:contains('" + data + "')").css("display", "block"); |
329 | | jQuery('#show-cats').hide(); |
330 | | jQuery('#hide-cats').show(); |
331 | | }); |
332 | | jQuery('#existing-categories').css('display','none'); |
333 | | }); |
334 | | </script> |
335 | | |
336 | | <input type="text" onfocus="jQuery('#cat-search').attr('value','');" id="cat-search" value="<?php esc_attr_e('Search Categories'); ?>" /> |
337 | | |
338 | | <a id="show-cats" style="cursor:pointer;" onclick="jQuery('#existing-categories').css('display','block');jQuery('#cat-search').attr('value','');jQuery('#existing-categories dt').css('display','block');jQuery('#show-cats').hide();jQuery('#hide-cats').show();"><?php _e('View All'); ?></a> |
339 | | <a id="hide-cats" style="cursor:pointer;" onclick="jQuery('#existing-categories').css('display','none');jQuery('#cat-search').attr('value','Search Categories');jQuery('#existing-categories dt').css('display','none');jQuery('#show-cats').show();jQuery('#hide-cats').hide();"><?php _e('Hide All'); ?></a> |
340 | | |
341 | | <script type="text/javascript"> |
342 | | jQuery('#hide-cats').hide(); |
343 | | </script> |
344 | | |
345 | | <ul id="existing-categories" class="list"> |
346 | | <?php |
347 | | $items_counter = wp_nav_menu_get_categories( $items_counter, 'default' ); |
348 | | ?> |
349 | | </ul> |
350 | | |
351 | | <div class="fix"></div> |
352 | | </div> |
353 | | </div><!-- /.widgets-holder-wrap --> |
354 | | |
355 | | <div class="widgets-holder-wrap"> |
356 | | <div class="sidebar-name"> |
357 | | <div class="sidebar-name-arrow"></div> |
358 | | <h3><?php esc_html_e('Add a Custom Url'); ?></h3> |
359 | | </div> |
360 | | <div class="widget-holder"> |
361 | | <input id="custom-menu-item-url" type="text" value="http://" /> |
362 | | <label for="custom-menu-item-url"><?php _e('URL'); ?></label><br /> |
363 | | <?php $template_dir = get_bloginfo('url'); ?> |
364 | | <input type="hidden" id="template-dir" value="<?php echo esc_attr($template_dir); ?>" /> |
365 | | <input id="custom-menu-item-name" type="text" value="<?php echo esc_attr( __('Menu Item') ); ?>" onfocus="jQuery('#custom-menu-item-name').attr('value','');" /> |
366 | | <label for="custom-menu-item-name"><?php _e('Menu Text'); ?></label><br /> |
367 | | <input id="custom_menu_item_description" type="text" value="<?php esc_attr_e('A description'); ?>" <?php if ($advanced_option_descriptions == 'no') { ?>style="display:none;"<?php } ?> onfocus="jQuery('#custom_menu_item_description').attr('value','');" /> |
368 | | <label <?php if ($advanced_option_descriptions == 'no') { ?>style="display:none;"<?php } ?> ><?php _e('Description'); ?></label> |
369 | | <a class="addtomenu" onclick="appendToList('<?php echo $template_dir; ?>','<?php echo esc_js( _x('Custom', 'menu nav item type') ); ?>','','','','0','');jQuery('#custom-menu-item-name').attr('value','<?php echo esc_js( __('Menu Item') ); ?>');jQuery('#custom_menu_item_description').attr('value','<?php echo esc_js( __('A description') ); ?>');"><?php _e('Add to menu'); ?></a> |
370 | | <div class="fix"></div> |
371 | | </div> |
372 | | </div><!-- /.widgets-holder-wrap --> |
373 | | </div><!-- /.hide-if-no-js --> |
374 | | </div> |
| 349 | <ul id="custom-nav"> |
| 350 | <?php |
| 351 | if ( $menu_selected_id > 0 ) { |
| 352 | wp_print_nav_menu( array( 'type' => 'backend', 'name' => $menu_title, 'id' => $menu_selected_id ) ); |
| 353 | } |
| 354 | ?> |
| 355 | </ul><!-- /#custom-nav--> |
| 356 | </div><!-- /.inside --> |
| 357 | <!-- /#nav-menu-canvas .postbox--> |
| 358 | </div> |
| 359 | <p class="submit"> |
| 360 | <script type="text/javascript"> |
| 361 | updatepostdata(); |
| 362 | </script> |
| 363 | <input id="save_bottom" name="save_bottom" type="submit" value="<?php esc_attr_e('Save All Changes'); ?>" /> |
| 364 | <input id="delete-menu" name="delete-menu" type="submit" value="<?php esc_attr_e('Delete This Menu'); ?>" /> |
| 365 | </p> |
| 366 | |
| 367 | <?php else : ?> |
| 368 | <div class="updated"><p><?php _e( 'Add a menu to start editing!' ); ?></p></div> |
| 369 | <?php endif; ?> |
| 370 | </div><!-- /#normal-sortables--> |
| 371 | </div><!-- /#post-body-content--> |
| 372 | </div><!--- /#post-body --> |
| 373 | <br class="clear" /> |
| 374 | </div><!-- /.metabox-holder has-right-sidebar--> |