Last active
August 6, 2018 18:08
-
-
Save ajmorris/60255a31d90dcab6efc7d6abd81d46ec to your computer and use it in GitHub Desktop.
making the description display for menu items with description filled out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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