Skip to content

Instantly share code, notes, and snippets.

@jpmarchand
Last active November 6, 2015 02:07
Show Gist options
  • Save jpmarchand/6727cd068afbc13afbf5 to your computer and use it in GitHub Desktop.
Save jpmarchand/6727cd068afbc13afbf5 to your computer and use it in GitHub Desktop.
Reduce navigation menu to one level depth in Genesis. Source: StudioPress Generate Pro child theme
<?php
//* Reduce the primary navigation menu to one level depth
add_filter( 'wp_nav_menu_args', 'prefix_generate_primary_menu_args' );
function prefix_generate_primary_menu_args( $args ){
if( 'primary' != $args['theme_location'] )
return $args;
$args['depth'] = 1;
return $args;
}
<?php
//* Reduce the secondary navigation menu to one level depth
add_filter( 'wp_nav_menu_args', 'prefix_generate_secondary_menu_args' );
function prefix_generate_secondary_menu_args( $args ){
if( 'secondary' != $args['theme_location'] )
return $args;
$args['depth'] = 1;
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment