Skip to content

Instantly share code, notes, and snippets.

@ajmorris ajmorris/functions.php
Last active Aug 6, 2018

Embed
What would you like to do?
making the description display for menu items with description filled out
<?php
// Adds the descriptions to menu output
function prefix_nav_description( $item_output, $item, $depth, $args ) {
if ( !empty( $item->description ) ) {
$item_output = str_replace( $args->link_after . '</a>', '<p class="menu-item-description">' . $item->description . '</p>' . $args->link_after . '</a>', $item_output );
}
return $item_output;
}
add_filter( 'walker_nav_menu_start_el', 'prefix_nav_description', 10, 4 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.