• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Enable / Disable superfish for specific menus

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Enable / Disable superfish for specific menus

This topic is: resolved

Tagged: menus, Superfish

  • This topic has 4 replies, 4 voices, and was last updated 7 years, 1 month ago by danbru1989.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • February 12, 2016 at 4:44 pm #178919
    atreidex
    Member

    Anyone knows if there's an easy way to enable or disable superfish separately for each menu?
    I have 3 different menus and only want to use superfish for 'primary' - can I somehow target & enable it only for 'nav-primary' ?

    Thanks a lot,
    Ciprian

    February 12, 2016 at 8:13 pm #178925
    Victor Font
    Moderator

    http://my.studiopress.com/snippets/scripts/


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    February 12, 2016 at 10:16 pm #178927
    carasmo
    Participant

    Yes. If you look at the arguments js file you'll see that the class js-superfish is what you need to remove from either menu. You would filter either menu in your functions.php file as follows:

    Link: https://gist.github.com/carasmo/7f4c4fa8b3877d882e47

    <?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' );
    

    Genesis Theme Customization and Help

    February 13, 2016 at 1:31 pm #178980
    atreidex
    Member

    Great - thanks a lot for the info!

    February 19, 2016 at 11:43 am #179405
    danbru1989
    Member

    After several hours of searching the web, this was exactly what I needed! Thanks for your help!

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Enable / Disable superfish for specific menus’ is closed to new replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble