Skip to content

Instantly share code, notes, and snippets.

@wpsmithtwc
Last active July 24, 2017 17:24
Show Gist options
  • Save wpsmithtwc/ec7a18eb0282d69968334f0a160fc369 to your computer and use it in GitHub Desktop.
Save wpsmithtwc/ec7a18eb0282d69968334f0a160fc369 to your computer and use it in GitHub Desktop.
Add description by menu location.
<?php
add_filter( 'wp_nav_menu_args', 'my_add_menu_descriptions' );
function my_add_menu_descriptions( $args ) {
if ( $args['theme_location'] == 'primary' ) {
$args['walker'] = new Menu_With_Description;
$args['desc_depth'] = 0;
$args['thumbnail'] = true;
$args['thumbnail_link'] = false;
$args['thumbnail_size'] = 'nav_thumb';
$args['thumbnail_attr'] = array( 'class' => 'nav_thumb my_thumb', 'alt' => 'test', 'title' => 'test' );
}
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment