* @version 1.1.0 * * @package WordPress * @subpackage Administration */ require_once('admin.php'); if ( ! current_user_can('switch_themes') ) wp_die( __( 'Cheatin’ uh?' )); wp_admin_css( 'custom-navigation' ); wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'jquery-ui-draggable' ); wp_enqueue_script( 'jquery-ui-droppable' ); wp_enqueue_script( 'jquery-ui-sortable' ); wp_enqueue_script( 'jquery-ui-dialog' ); wp_enqueue_script( 'custom-navigation-dynamic-functions' ); wp_enqueue_script( 'custom-navigation-default-items' ); wp_enqueue_script( 'jquery-autocomplete' ); wp_enqueue_script( 'custom-navigation-php-functions' ); require_once('admin-header.php'); require_once (ABSPATH . WPINC . '/custom-navigation.php'); function wp_reset_nav_menu() { wp_custom_navigation_setup(true); return true; } $messagesdiv = ''; $menu_id_in_edit = 0; // Check which menu is selected and if menu is in edit already if ( isset( $_POST['switch_menu'] ) ) $menu_selected_id = (int) $_POST['menu_select']; elseif ( isset( $_POST['menu_id_in_edit'] ) ) $menu_selected_id = (int) $_POST['menu_id_in_edit']; else $menu_selected_id = 0; // Default Menu to show $custom_menus = get_terms( 'nav_menu', array( 'hide_empty' => false ) ); if ( !empty( $custom_menus ) ) $menu_selected_id = $custom_menus[0]->term_id; $menu_title = ''; if ( $menu_selected_id > 0 ) { foreach ( $custom_menus as $menu ) { if ( $menu->term_id == $menu_selected_id ) { $menu_title = $menu->name; break; } } } if ( isset( $_POST['set_wp_menu'] ) ) { // @todo validate set_wp_menu update_option( 'wp_custom_nav_menu', $_POST['enable_wp_menu'] ); $messagesdiv = '
' . __('Menu has been updated!') . '
' . esc_html( $menu->get_error_message() ) . '
' . esc_html( sprintf( __('"%s" menu has been created!'), $menu->name ) ) . '
' . __('Please enter a valid menu name.') . '
' . __('The menu has been reset.') . '
' . __('The menu could not be reset. Please try again.') . '
' . __('The menu has been updated.') . '
' . __('Menu editing has not been Enabled yet. Please enable it in order to use it -------->') . '