Created
September 8, 2022 10:30
-
-
Save irwingb1979/0b7b3d096434ea24eb10d10601475bf1 to your computer and use it in GitHub Desktop.
Menu item description wordpress
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
/* Add description item menu */ | |
add_filter('walker_nav_menu_start_el', 'agregar_descripcion', 10, 4); | |
function agregar_descripcion($item_output, $item, $depth, $args) { | |
if( !empty( $item->description ) ) { | |
return str_replace('</a>' , '<span class="description">' . $item->description . '</span></a>', $item_output); | |
} | |
return $item_output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment