Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * ==============================================================================
- * INSERT CLASSES IN TO NAV ITEMS
- * ==============================================================================
- */
- /**
- * Store class names in menu description field.
- * Used, eg. to make a nav item hidden
- */
- /**
- * Descriptions on Header Menu
- * @author Bill Erickson
- * @link http://www.billerickson.net/code/add-description-to-wordpress-menu-items/
- *
- * @param string $item_output, HTML outputp for the menu item
- * @param object $item, menu item object
- * @param int $depth, depth in menu structure
- * @param object $args, arguments passed to wp_nav_menu()
- * @return string $item_output
- */
- // Use menu item description field to store class name for output to link
- function be_header_menu_desc( $item_output, $item, $depth, $args ) {
- // Only if menu is footermenu1
- if( 'footermenu1' == $args->theme_location && ! $depth && $item->description )
- $item_output = str_replace( '<a ', '<a ' . $item->description .' ', $item_output );
- return $item_output;
- }
- add_filter( 'walker_nav_menu_start_el', 'be_header_menu_desc', 10, 4 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement