Menu_With_Description

The Carbon Light - Business responsive Menu With Description class.

Defined (1)

The class is defined in the following location(s).

/functions.php  
  1. class Menu_With_Description extends Walker_Nav_Menu { 
  2.  
  3. function start_lvl(&$output, $depth) { 
  4. $indent = str_repeat("\t", $depth); 
  5. //$output .= "\n$indent<ul class=\"sub-menu\">\n"; 
  6. // Change sub-menu to dropdown menu 
  7. $output .= "\n$indent<ul class=\"dropdown\">\n"; 
  8.  
  9. function start_el(&$output, $item, $depth, $args) { 
  10. global $wp_query; 
  11. $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; 
  12.  
  13. $class_names = $value = ''; 
  14.  
  15. $classes = empty( $item->classes ) ? array() : (array) $item->classes; 
  16.  
  17. $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) ); 
  18. $class_names = ' class="' . esc_attr( $class_names ) . '"'; 
  19.  
  20. $output .= $indent . '<li id="menu-item-'. $item->ID . '"' . $value . $class_names .'>'; 
  21.  
  22. $attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : ''; 
  23. $attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : ''; 
  24. $attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : ''; 
  25. $attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : ''; 
  26.  
  27. $item_output = $args->before; 
  28. $item_output .= '<a'. $attributes .'>'; 
  29. $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; 
  30. $item_output .= '<br /><span class="subtitle">' . $item->description . '</span>'; 
  31. $item_output .= '</a>'; 
  32. $item_output .= $args->after; 
  33.  
  34. $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );