$field){ if (isset($_REQUEST['menu-item-'.$field][$menu_item_db_id])) { $mega_value = $_REQUEST['menu-item-'.$field][$menu_item_db_id]; update_post_meta( $menu_item_db_id, '_menu_item_'.$field, $mega_value ); } } } /* * Adds value of new field to $item object that will be passed to tx_Walker_Nav_Menu_Edit_Custom */ add_filter( 'wp_setup_nav_menu_item','tx_custom_nav_item' ); function tx_custom_nav_item($menu_item) { $fields = array('submenu_type','dropdown_type','widget_area','hide_link','bg_image','bg_image_attachment','bg_image_size','bg_image_position','bg_image_repeat','bg_color','menu_icon','highlight', 'con_visiblity', 'con_role'); foreach($fields as $i=>$field){ $menu_item->$field = get_post_meta( $menu_item->ID, '_menu_item_'.$field, true ); } return $menu_item; } add_action( 'admin_enqueue_scripts','tx_add_js_mega_menu'); function tx_add_js_mega_menu(){ wp_enqueue_script( 'tx_menu_set_background', TX_JS . 'mega-menu.min.js', array( 'jquery', 'jquery-ui-sortable' ), false, true ); wp_enqueue_media(); add_thickbox(); } add_filter( 'wp_edit_nav_menu_walker', 'tx_custom_nav_edit_walker',10,2 ); function tx_custom_nav_edit_walker($menu_id) { return 'tx_Walker_Nav_Menu_Edit_Custom'; } class tx_Walker_Nav_Menu_Edit_Custom extends Walker_Nav_Menu { public function start_lvl( &$output, $depth = 0, $args = array() ) {} public function end_lvl( &$output, $depth = 0, $args = array() ) {} public function start_el( &$output, $item, $depth = 0, $args = array(), $current_object_id = 0 ) { global $_wp_nav_menu_max_depth; $_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth; $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; ob_start(); $item_id = esc_attr( $item->ID ); $removed_args = array( 'action', 'customlink-tab', 'edit-menu-item', 'menu-item', 'page-tab', '_wpnonce', ); $original_title = ''; if ( 'taxonomy' == $item->type ) { $original_title = get_term_field( 'name', $item->object_id, $item->object, 'raw' ); if ( is_wp_error( $original_title ) ) $original_title = false; } elseif ( 'post_type' == $item->type ) { $original_object = get_post( $item->object_id ); $original_title = $original_object->post_title; } $classes = array( 'menu-item menu-item-depth-' . $depth, 'menu-item-' . esc_attr( $item->object ), 'menu-item-edit-' . ( ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? 'active' : 'inactive'), ); $title = $item->title; if ( ! empty( $item->_invalid ) ) { $classes[] = 'menu-item-invalid'; /* translators: %s: title of menu item which is invalid */ $title = sprintf( __( '%s (Invalid)', 'avas'), $item->title ); } elseif ( isset( $item->post_status ) && 'draft' == $item->post_status ) { $classes[] = 'pending'; /* translators: %s: title of menu item in draft status */ $title = sprintf( __('%s (Pending)', 'avas'), $item->title ); } $title = empty( $item->label ) ? $title : $item->label; ?>