db_fields = $fields; } } /** * Starts the list before the elements are added. * * @see Walker_Nav_Menu::start_lvl() * * @since 3.0.0 * * @param string $output Passed by reference. Used to append additional content. * @param int $depth Depth of page. Used for padding. * @param array $args Not used. */ public function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat( "\t", $depth ); } /** * Ends the list of after the elements are added. * * @see Walker_Nav_Menu::end_lvl() * * @since 3.0.0 * * @param string $output Passed by reference. Used to append additional content. * @param int $depth Depth of page. Used for padding. * @param array $args Not used. */ public function end_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat( "\t", $depth ); } /** * Start the element output. * * @see Walker_Nav_Menu::start_el() * * @since 3.0.0 * * @global int $_nav_menu_placeholder * * @param string $output Passed by reference. Used to append additional content. * @param object $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @param array $args Not used. * @param int $id Not used. */ public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { global $_nav_menu_placeholder; global $gloable_all_author_array; global $gloable_all_template_array; global $gloable_all_category_array; global $gloable_all_current_menu_id; $recently_edited = absint( get_user_option( 'nav_menu_recently_edited', get_current_user_id()) ); if(!empty($recently_edited)){ $menu_items = wp_get_nav_menu_items($recently_edited); if(isset($menu_items) && !empty($menu_items)) { for ( $amm=0; $amm < count($menu_items); $amm++ ) { $gloable_all_current_menu_id[] = $menu_items[$amm]->object_id; } } } // set all template globaly $get_templates_all = get_page_templates(); foreach ( $get_templates_all as $template_name => $template_filename ) { $gloable_all_template_array[$template_name] = $template_filename; } $current_menu_post_id = $gloable_all_current_menu_id; $cate_array = array(); $cate_id_array = array(); $current_post_category = ''; $allready_menu_class=''; if(empty($item->front_or_home) && empty($item->term_id) && !empty($item->post_author)) $post_author_name = get_the_author_meta('display_name',$item->post_author); $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1; //phpcs:ignore $possible_object_id = isset( $item->post_type ) && 'nav_menu_item' === $item->post_type ? $item->object_id : $_nav_menu_placeholder; $possible_db_id = ( ! empty( $item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $item->ID : 0; $possible_db_id = $item->ID; $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; $chiled_dash = ''; if(is_array($current_menu_post_id) && count($current_menu_post_id) >= 1 ){ if (in_array( ( string ) $item->object_id, $current_menu_post_id, true)) { $allready_menu_class = " menu_exists";} } if(!empty($indent)){ $output .= $indent . '
  • '; for ($i=0; $i < strlen($indent); $i++){ $chiled_dash .='- '; } }else{ $output .= $indent . '
  • '; } $item_ID = esc_attr($item->object_id); if(!empty($item->front_or_home)) {$item_ID = '-';} if(empty($item->term_id)){ $output .= ''; }else{ $output .= ''; } $output .= ''; if ( ! empty( $item->label ) ) { $title = $item->label; } elseif ( isset( $item->post_type ) ) { /** This filter is documented in wp-includes/post-template.php */ $title = apply_filters( 'the_title', $item->post_title, esc_attr($item->ID) ); if ( ! empty( $item->front_or_home ) && _x( 'Home', 'nav menu home label', 'advance-menu-manager' ) !== $title ) $title = sprintf( _x( 'Home: %s', 'nav menu front page title', 'advance-menu-manager' ), $title ); } // Menu item hidden fields $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; if(empty($item->term_id)){$output .= $item_ID; } $output .= ''; $output .= ' '; $output .= (strlen($chiled_dash.esc_html($item->title)) > 35) ? substr($chiled_dash.esc_html($item->title), 0, 35).'...' : $chiled_dash.esc_html($item->title); $output .=''; if(empty($item->term_id)){ if( !empty($item->front_or_home) ){ //fornt page menu item $output .= '-'; $output .=' - '; $output .=' - '; $output .=' - '; }else{ // display page/post custom post type menu item. if(!empty($item->post_name)) { $output .= ''; $output .= (strlen($item->post_name) > 20) ? substr($item->post_name, 0, 20).'...' : $item->post_name; $output .= ''; }else{ $output .= '-'; } if(!empty($post_author_name)) { $output .=''.$post_author_name.''; }else{ $output .='' . esc_html__('admin', 'advance-menu-manager') . ''; } if('page' === $item->post_type){ $display_template_name = ''; $tamplate_name = get_post_meta( $item->object_id,'_wp_page_template',true); if('default' === $tamplate_name || empty($tamplate_name)){ $display_template_name .='default'; }else if(!empty($gloable_all_template_array)){ $template_name_key = array_search( $tamplate_name, $gloable_all_template_array, true ); if (!empty($template_name_key)) { $tamplate_name = $template_name_key; }else{ $tamplate_name = 'default'; } $display_template_name = $tamplate_name; } $output .=''; $output .= (strlen($display_template_name) > 20) ? substr($display_template_name, 0, 20).'...' : $display_template_name; $output .=''; }else{ $category_detail=get_the_category($item->object_id); $output .=''; if(!empty($category_detail) && count($category_detail) > 0) { foreach($category_detail as $cd){ $cate_array[]= $cd->cat_name; $cate_id_array[]= $cd->cat_ID; } $current_post_category = implode(',',$cate_array); $output .= $current_post_category; }else{ $output .='-'; } $output .=''; } $output .=''.get_the_date('', $item->object_id).''; } }else{ // display taxonomy item $output .=''.$item->slug.''; if(!empty($item->description)) { $output .=''.$item->description.''; }else{ $output .='-'; } } } } // Walker_Nav_Menu_Checklist