I recently found out that in WordPress there is an option to add custom descriptions to menu items. This looks nice but there’s no default way to display these descriptions at the front-end.
In my new theme, I thought it would be nice to display the webshop categories / menu-items using a custom description. Online I’ve found some snippets but none seems to work well. Hereby I share my solution with you.
First, enter the WordPress back-end at Appearance >Menus. Next click in the top right corner the ‘Screen Options‘ button. Finally select the descriptions box, as shown here.
When opening an menu-item a description input field is visible now. You only have to add a description and save the menu.
Finally, add the following snippet to your functions.php
All that is left to do is styling the menu and the description to your choice. Have fun!
Gosia says
Thank you! It’s so simple… other solutions I’ve found were way too much complicated.
Tom says
Frank, thanks for the tutorial! The only issue I’ve found with this approach is that the description container still appears even if a description isn’t populated.
Jonathan Torres says
I tried this code in Moody Theme and it Worked really Nice!
Thanks for the help.