jakecleary / wp-nav-walker

A custom nav walker to simplify the wp_nav_menu() markup and make it easier to style.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WP Nav Walker

Overview

A PHP class that integrates into the WP Nav Menu function to strip out the defualt classes and replace them with a simple, descriptive set comprised of the following:

  • Parent lis are given the .has-children class
  • Child uls are given the .sub-menu class
  • The current page li is given the .active class

Installation & Usage

You can just grab the nav-walker-class.php file and include it in your functions file.

require_once('custom-nav-walker-class.php');

And then include the class as a parameter when you use wp_nav_menu(). I've included an example function with the custom walker as an below:

<?php

$args = array(
    ...
    'walker' => new custom_nav_walker()
);

wp_nav_menu( $args );

?>

About

A custom nav walker to simplify the wp_nav_menu() markup and make it easier to style.


Languages

Language:PHP NaN%