indigotree / wp-bootstrap-nav-walker
WordPress Nav Walkers to implement Bootstrap navbars.
Installs: 1 943
Dependents: 0
Suggesters: 0
Security: 0
Stars: 9
Watchers: 7
Forks: 9
Open Issues: 0
Requires
- php: >=5.4.0
This package is auto-updated.
Last update: 2024-11-17 18:33:38 UTC
README
WordPress Nav Walkers to implement Bootstrap navbars.
Requirements
- PHP 5.4+
- WordPress 4.4+
Installation
Easy installation with Composer.
composer require indigotree/wp-bootstrap-nav-walker
Usage (Bootstrap 3)
Update wp_nav_menu()
to use the IndigoTree\BootstrapNavWalker\Three\WalkerNavMenu
walker. For example:
<?php wp_nav_menu([ 'theme_location' => 'primary', 'depth' => 2, 'container' => 'div', 'container_class' => 'collapse navbar-collapse', 'container_id' => 'primary-navbar-collapse', 'menu_class' => 'nav navbar-nav', 'fallback_cb' => '__return_empty_string', 'walker' => new \IndigoTree\BootstrapNavWalker\Three\WalkerNavMenu() ]);
Usage (Bootstrap 4)
Update wp_nav_menu()
to use the IndigoTree\BootstrapNavWalker\Four\WalkerNavMenu
walker. For example:
<?php wp_nav_menu([ 'theme_location' => 'primary', 'depth' => 2, 'container' => 'div', 'container_class' => 'collapse navbar-collapse', 'container_id' => 'primary-navbar-collapse', 'menu_class' => 'navbar-nav', 'fallback_cb' => '__return_empty_string', 'walker' => new \IndigoTree\BootstrapNavWalker\Four\WalkerNavMenu() ]);
License
The MIT License (MIT).