Title: Replace existing menu with ShiftNav
Last modified: August 22, 2016

---

# Replace existing menu with ShiftNav

 *  Resolved [triplemoons](https://wordpress.org/support/users/triplemoons/)
 * (@triplemoons)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/replace-existing-menu-with-shiftnav/)
 * Is it possible to replace the default theme navigation with the toggle rather
   then having the toggle bar? I couldn’t locate anything about this.
 * [https://wordpress.org/plugins/shiftnav-responsive-mobile-menu/](https://wordpress.org/plugins/shiftnav-responsive-mobile-menu/)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Thread Starter [triplemoons](https://wordpress.org/support/users/triplemoons/)
 * (@triplemoons)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/replace-existing-menu-with-shiftnav/#post-5581065)
 * For anyone else looking for a solution to this, I was successful by using…
 * `<a class="shiftnav-toggle" data-shiftnav-target="shiftnav-main"><i class="icon-
   align-justify"></i></a>`
 * …in the Navigation Label.
 * Though I am still left with a problem on the mobile view that I have to sort 
   out if their isn’t a better way to do this.
 * The advanced content features in the Pro version is enough to make me buy the
   Pro version for the nominal fee, but I would still like to know if their is a
   better solution to accomplish what I’m looking for.
 *  Plugin Author [sevenspark](https://wordpress.org/support/users/sevenspark/)
 * (@sevenspark)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/replace-existing-menu-with-shiftnav/#post-5581156)
 * Hi triplemoons,
 * You can disable the toggle bar in the Control Panel.
 * Then you can place a [Custom Toggle](http://sevenspark.com/docs/shiftnav-toggles)
   wherever you like in your theme to trigger ShiftNav. I would not recommend placing
   it inside a menu item, as I believe you’ll end up with nested anchors, which 
   could cause issues.
 * You would then remove your theme’s menu if you like by removing that code from
   the header template.
 * Note you’d make those changes in a child theme in order to preserve them for 
   next time you update the theme; most likely you’d be overriding the header.php
 * There isn’t a way to automatically do this, as it requires adding and removing
   code in a specific location in a theme template.
 * Hope that helps!
 * Chris
 *  Thread Starter [triplemoons](https://wordpress.org/support/users/triplemoons/)
 * (@triplemoons)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/replace-existing-menu-with-shiftnav/#post-5581158)
 * Yes, I know I can disable the toggle bar in the settings. But that doesn’t replace
   the default menu with ShiftNav which is what I want to do. I was looking for 
   a solution that didn’t require modifying the theme.
 *  Plugin Author [sevenspark](https://wordpress.org/support/users/sevenspark/)
 * (@sevenspark)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/replace-existing-menu-with-shiftnav/#post-5581208)
 * Right, I was saying it was a 3-step process (1) disable toggle, (2) insert custom
   toggle, (3) remove theme menu
 * If you wanted to avoid editing the template, I suppose you could do something
   clever like this and short-circuit the menu output in the child theme:
 *     ```
       add_filter( 'pre_wp_nav_menu' , 'replace_menu_with_shiftnav' );
       function replace_menu_with_shiftnav( $nav_menu , $args ){
       	return '<a class="shiftnav-toggle" data-shiftnav-target="shiftnav-main"><i class="fa fa-bars"></i></a>';
       }
       ```
   
 * That code replaces all menus with a ShiftNav toggle. Note that you’d want to 
   add some conditional logic in there if you have more than one wp_nav_menu call
   in your theme.
 * Hope that helps 🙂
 * Chris
 *  Thread Starter [triplemoons](https://wordpress.org/support/users/triplemoons/)
 * (@triplemoons)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/replace-existing-menu-with-shiftnav/#post-5581212)
 * Plugin is throwing an error.
 * `[16-Dec-2014 22:17:45 UTC] PHP Notice: Undefined variable: id in /xxxx/xxxxxxx/
   public_html/wp-content/plugins/shiftnav-pro/includes/functions.php on line 404`
 *  Plugin Author [sevenspark](https://wordpress.org/support/users/sevenspark/)
 * (@sevenspark)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/replace-existing-menu-with-shiftnav/#post-5581278)
 * Hi triplemoons,
 * That’s a warning that occurred in the Pro beta – nothing to worry about (it won’t
   break anything), but please download the latest beta which resolves it: shiftnav-
   pro-1.2.1-beta-3.zip – thanks!
 * Also, regarding that PHP snippet I provided above, I’d suggest making it more
   robust like this:
 *     ```
       //Replace menu with shiftnav toggle
       add_filter( 'pre_wp_nav_menu' , 'replace_menu_with_shiftnav' , 50 , 2 );
       function replace_menu_with_shiftnav( $nav_menu , $args ){
       	if( $args->theme_location == 'primary' ){
       		return '<a class="shiftnav-toggle" data-shiftnav-target="shiftnav-main"><i class="fa fa-bars"></i> Menu</a>';
       	}
       	return $nav_menu;
       }
       ```
   
 * Replace `primary` with your own theme location to make sure the code only targets
   the specific menu you’re looking to replace.
 * Looks like you’re using the Pro version now? Please post your questions in the
   [Support Forum](http://sevenspark.com/support) to receive support for the Pro
   version – thanks! 🙂
 * Best,
 * Chris

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Replace existing menu with ShiftNav’ is closed to new replies.

 * ![](https://ps.w.org/shiftnav-responsive-mobile-menu/assets/icon-256x256.jpg?
   rev=2247219)
 * [ShiftNav - Responsive Mobile Menu](https://wordpress.org/plugins/shiftnav-responsive-mobile-menu/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/shiftnav-responsive-mobile-menu/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/shiftnav-responsive-mobile-menu/)
 * [Active Topics](https://wordpress.org/support/plugin/shiftnav-responsive-mobile-menu/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shiftnav-responsive-mobile-menu/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shiftnav-responsive-mobile-menu/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [sevenspark](https://wordpress.org/support/users/sevenspark/)
 * Last activity: [11 years, 4 months ago](https://wordpress.org/support/topic/replace-existing-menu-with-shiftnav/#post-5581278)
 * Status: resolved