Skip to content

Instantly share code, notes, and snippets.

@studiograsshopper
Created January 5, 2012 19:09
Show Gist options
  • Save studiograsshopper/1566701 to your computer and use it in GitHub Desktop.
Save studiograsshopper/1566701 to your computer and use it in GitHub Desktop.
Backcountry theme - subnav descriptions
<?php
/** Add description to secondary navigation */
add_filter( 'walker_nav_menu_start_el', 'add_description', 10, 4 );
function add_description( $item_output, $item, $depth, $args ) {
$args = (array) $args;
if ( $args['theme_location'] != 'primary' ) {
return preg_replace( '/(<a.*?>[^<]*?)</', '$1' . "<span class=\"menu-description\">{$item->post_content}</span><", $item_output );
} else {
return $item_output;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment