This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Tagged: 

Use "Description" (advanced menu properties) in main menu?

  • Creator
    Topic
  • #18039
    kennethfeldman
    Participant

    Hi Jason,

    Is there a way to activate/use the description property in the main menu, to make a smaller second row of text in the menu titles?

    Like…

    ABOUT
    about this company

    PRODUCTS
    our selection of things

    Thank you in advance for your reply.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #18044
    Jason Bobich
    Keymaster

    Hello,

    There’s a few ways to do this, but I think the easiest way is just to filter onto “walker_nav_menu_start_el” — which is a WordPress filter across all nav menu elements.

    function my_nav_menu_start_el( $item_output, $item ) {
    
    	// Description will be at $item->post_content within current $item object
    	// For example:
    	if ( $item->post_content ) { 
    		$item_output .= sprintf( '<span class="desc">%s</span>', $item->post_content );
    	}
    
    	return $item_output;
    }
    add_filter( 'walker_nav_menu_start_el', 'my_nav_menu_start_el', 10, 2 );

    From there, you’re then just mainly dealing with the CSS to style it to fit. It’ll probably look a bit wonky at first.

    #18045
    kennethfeldman
    Participant

    Super! I’ll check this out in the AM.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.