Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. <?php
  2.  
  3. /*********************
  4. *Custom menu walker for My Website
  5. *@author Adrian7 (http://adrian.silimon.eu)
  6. *@version 1.0
  7. *********************/
  8.  
  9. class Custom_Menu_Walker extends Walker_Nav_Menu{
  10.  
  11.     public $ArrayItems = array();
  12.    
  13.     /**
  14.      * @see Walker::start_el()
  15.      * @since 3.0.0
  16.      *
  17.      * @param string $output Passed by reference. Used to append additional content.
  18.      * @param object $item Menu item data object.
  19.      * @param int $depth Depth of menu item. Used for padding.
  20.      * @param int $current_page Menu item ID.
  21.      * @param object $args
  22.      */
  23.     function start_el(&$output, $item, $depth, $args) {
  24.         global $wp_query;
  25.         $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
  26.  
  27.         $class_names = $value = '';
  28.  
  29.         $classes = empty( $item->classes ) ? array() : (array) $item->classes;
  30.         $classes[] = 'menu-item-' . $item->ID;
  31.  
  32.         $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
  33.         $class_names = ' class="' . esc_attr( $class_names ) . '"';
  34.  
  35.         $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
  36.         $id = strlen( $id ) ? ' id="' . esc_attr( $id ) . '"' : '';
  37.  
  38.         $output .= $indent . ' <div class="item" align="left">';
  39.        
  40.         $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';
  41.         $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';
  42.         $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';
  43.         $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';
  44.        
  45.         $item_output = $args->before;
  46.         $item_output .= '<a'. $attributes .'>&nbsp;&nbsp; ';
  47.         $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
  48.         $item_output .= '&nbsp;&nbsp;</a>';
  49.         $item_output .= $args->after;
  50.  
  51.         $this->ArrayItems[$item->ID] =  array('title'=>$item->title, 'url'=>$item->url);
  52.        
  53.         $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
  54.     }
  55. }
  56. ?>