Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.