Advertisement
Guest User

Untitled

a guest
Dec 16th, 2011
441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. class to_upper_walker extends Walker_Nav_Menu
  2. {
  3. function start_el(&$output, $item, $depth, $args) {
  4. global $wp_query;
  5. $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
  6.  
  7. $class_names = $value = '';
  8.  
  9. $classes = empty( $item->classes ) ? array() : (array) $item->classes;
  10. $classes[] = 'menu-item-' . $item->ID;
  11.  
  12. $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
  13. $class_names = ' class="' . esc_attr( $class_names ) . '"';
  14.  
  15. $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
  16. $id = strlen( $id ) ? ' id="' . esc_attr( $id ) . '"' : '';
  17.  
  18. $output .= $indent . '<li' . $id . $value . $class_names .'>';
  19.  
  20. $attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : '';
  21. $attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : '';
  22. $attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : '';
  23. $attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
  24.  
  25. $item_output = $args->before;
  26. $item_output .= '<a'. $attributes .'>';
  27. $item_output .= $args->link_before . apply_filters( 'the_title', strtoupper($item->title), $item->ID ) . $args->link_after;
  28. $item_output .= '</a>';
  29. $item_output .= $args->after;
  30.  
  31. $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement