Advertisement
Guest User

Add Category descriptions to menus

a guest
Jan 17th, 2011
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.53 KB | None | 0 0
  1. if ( function_exists('wp_nav_menu') ) {
  2.     add_theme_support( 'nav-menus' );
  3.     register_nav_menus( array( 'primary-menu' => __( 'Primary Menu' ), 'secondary-menu' => __( 'Secondary Menu' ) ) );
  4.  
  5.     // Add category descriptions
  6.     if ( get_option('woo_menu_desc') == "true" ) {
  7.         add_filter('walker_nav_menu_start_el', 'description_in_nav_el', 10, 4);
  8.         function description_in_nav_el($item_output, $item, $depth, $args) {
  9.             return preg_replace('/(<a.*?>[^<]*?)</', '$1' . "<br /><span>{$item->post_content}</span><", $item_output);
  10.         }
  11.     }
  12.  
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement