Skip to content

Instantly share code, notes, and snippets.

@irwingb1979
Created September 8, 2022 10:30
Show Gist options
  • Save irwingb1979/0b7b3d096434ea24eb10d10601475bf1 to your computer and use it in GitHub Desktop.
Save irwingb1979/0b7b3d096434ea24eb10d10601475bf1 to your computer and use it in GitHub Desktop.
Menu item description wordpress
/* 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