Show description with line breaks

I have a problem with my theme…

I use Agama, and i’ve checkmarked “description” in the menu settings, but it won’t display it on the frontend, since the theme doesn’t allow it.

But then I found this function:

function prefix_nav_description( $item_output, $item, $depth, $args ) {
if ( !empty( $item->description ) ) {
$item_output = str_replace( $args->link_after . ‘</a>’, ‘<span class=”menu-item-description”>’ . $item->description . ‘</span>’ . $args->link_after . ‘</a>’, $item_output );
}
return $item_output;
}
add_filter( ‘walker_nav_menu_start_el’, ‘prefix_nav_description’, 10, 4 );

That helped me get the description to be shown.
But i can’t make line-breaks in my description. Everytime I just make a line-break or inserts
and save the changes, it removes the changes again.

So can anyone help me with a function that both makes the description be showned and also makes it possible for me to add
in the description.

Thanks 😀

Read more here:: Show description with line breaks

Leave a Reply

Your email address will not be published. Required fields are marked *