Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created April 29, 2016 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/f1de0f5954ed64c69ef04e88fcd251c3 to your computer and use it in GitHub Desktop.
Save billerickson/f1de0f5954ed64c69ef04e88fcd251c3 to your computer and use it in GitHub Desktop.
<?php
function be_add_description( $item_output, $item ) {
$description = $item-&gt;post_content;
if (' ' !== $description )
return preg_replace( '/(<a>[^&lt;]*?)&lt;/&#039;, &#039;$1&#039; . &#039;' . $description . '&lt;&#039;, $item_output);
else
return $item_output;
}
add_filter( &#039;walker_nav_menu_start_el&#039;, &#039;be_add_description&#039;, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment