Skip to content

Commit d53b3db

Browse files
committed
Add note about becoming default walker used within a theme.
Closes: #258
1 parent 592c21f commit d53b3db

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,20 @@ Review options in the Bootstrap docs for more information on [nav classes](https
119119

120120
To display the menu you must associate your menu with your theme location. You can do this by selecting your theme location in the *Theme Locations* list wile editing a menu in the WordPress menu manager.
121121

122+
### Making this Walker the Default Walker for Nav Manus
123+
124+
There has been some interest in making this walker the default walker for all menus. That could result in some unexpected situations but it can be achieved by adding this function to your functions.php file.
125+
126+
```php
127+
function prefix_modify_nav_menu_args( $args ) {
128+
return array_merge( $args, array(
129+
'walker' => WP_Bootstrap_Navwalker(),
130+
) );
131+
}
132+
add_filter( 'wp_nav_menu_args', 'prefix_modify_nav_menu_args' );
133+
```
134+
Simply updating the walker may not be enough to get menus working right, you may need to add wrappers or additional classes, you can do that via the above function as well.
135+
122136
### Extras
123137

124138
This script included the ability to add Bootstrap dividers, dropdown headers, glyphicons and disables links to your menus through the WordPress menu UI.

0 commit comments

Comments
 (0)