Skip to content

Instantly share code, notes, and snippets.

@carasmo
Last active August 29, 2022 22:47
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carasmo/7f4c4fa8b3877d882e47 to your computer and use it in GitHub Desktop.
Save carasmo/7f4c4fa8b3877d882e47 to your computer and use it in GitHub Desktop.
filter the Genesis navigation classes to remove super fish from either menu.
<?php
// don't include the php tag
// this goes in your functions.php file in your child theme. Use a code editor and FTP,
// do not edit php files with the editor in the backend of WordPress.
// Use developer tools if you do developer work.
/** ====================================================================================
* Entirely replace the classes on the
* nav-primary > ul and remove the class .js-superfish
==================================================================================== **/
function yourprefix_remove_superfish_nav_primary( $args ) {
if( 'primary' == $args['theme_location'] ) {
$args['menu_class'] = 'menu genesis-nav-menu menu-primary';
}
return $args;
}
add_filter( 'wp_nav_menu_args', 'yourprefix_remove_superfish_nav_primary' );
/** ====================================================================================
* Entirely replace the classes on the
* nav-secondary > ul and remove the class .js-superfish
==================================================================================== **/
function yourprefix_remove_superfish_nav_secondary( $args ) {
if( 'secondary' == $args['theme_location'] ) {
$args['menu_class'] = 'menu genesis-nav-menu menu-secondary';
}
return $args;
}
add_filter( 'wp_nav_menu_args', 'yourprefix_remove_superfish_nav_secondary' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment