diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..55a8202 --- /dev/null +++ b/Readme.md @@ -0,0 +1,22 @@ +1) Place navwalker.php in your WordPress theme folder /wp-content/your-theme/ + +2) To use Bulma-navwalker add these lines to your functions.php + +require_once('navwalker.php'); +register_nav_menus( array( + 'primary' => __( 'Primary Menu', 'missionfit' ), +) ); + +3) Then add this initializer in your header (either index.php, header.php, etc...) + wp_nav_menu( array( + 'theme_location' => 'primary', + 'depth' => 2, + 'container' => false, + // 'items_wrap' => 'div', + 'menu_class' => 'navbar-menu', + 'menu_id' => 'primary-menu', + 'after' => "", + 'walker' => new Navwalker()) + ); + +3) Congratulations you are now using Bulma! \ No newline at end of file diff --git a/navwalker.php b/navwalker.php new file mode 100644 index 0000000..983fd7d --- /dev/null +++ b/navwalker.php @@ -0,0 +1,61 @@ +"; + } + + public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { + + $liClasses = 'navbar-item '.$item->title; + + $hasChildren = $args->walker->has_children; + $liClasses .= $hasChildren? " has-dropdown is-hoverable": ""; + + if($hasChildren){ + $output .= "